Skip to content

Latest commit

 

History

History
11 lines (9 loc) · 891 Bytes

File metadata and controls

11 lines (9 loc) · 891 Bytes

Error Traces and Fixes

2025-10-08 — SwiftUI .commands misuse

  • Symptom: Reference to member 'commands' cannot be resolved without a contextual type (ChatView.swift:36).
  • Cause: Applied .commands { … } as a View modifier. In SwiftUI, .commands attaches to a Scene (inside the App body), not a View. Without a Scene context, the member cannot be resolved.
  • Fix: Removed .commands from ChatView and deleted the unused AppCommands type. Kept keyboard shortcuts on toolbar buttons and the command palette via sheet.
  • Prevention:
    • Use .commands only in App/Scene builders (e.g., WindowGroup { … }.commands { … }).
    • For view-scoped actions, prefer toolbar buttons with keyboardShortcut or a custom palette sheet.
    • When adding global menu items, define commands in interview_coderApp and pass actions via environment or coordinators.