- Symptom:
Reference to member 'commands' cannot be resolved without a contextual type(ChatView.swift:36). - Cause: Applied
.commands { … }as a View modifier. In SwiftUI,.commandsattaches to aScene(inside theAppbody), not aView. Without aScenecontext, the member cannot be resolved. - Fix: Removed
.commandsfromChatViewand deleted the unusedAppCommandstype. Kept keyboard shortcuts on toolbar buttons and the command palette viasheet. - Prevention:
- Use
.commandsonly inApp/Scenebuilders (e.g.,WindowGroup { … }.commands { … }). - For view-scoped actions, prefer toolbar buttons with
keyboardShortcutor a custom palettesheet. - When adding global menu items, define commands in
interview_coderAppand pass actions via environment or coordinators.
- Use