swiftship/internal/skills/data/macos/keyboard-shortcuts/SKILL.md
macOS keyboard shortcut patterns: keyboardShortcut modifier, CommandMenu, CommandGroup, menu bar customization. Use when implementing macOS keyboard shortcuts, menu bar commands, or hotkeys. Triggers: keyboard, shortcut, CommandMenu, CommandGroup, menu bar, hotkey.
npx skillsauth add abdullah4ai/apple-dev-docs keyboard-shortcutsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Every primary action in a macOS app MUST have a keyboard shortcut.
Button("Save") { save() }
.keyboardShortcut("s", modifiers: .command)
Button("New") { createNew() }
.keyboardShortcut("n", modifiers: .command)
Button("Delete") { deleteSelected() }
.keyboardShortcut(.delete, modifiers: .command)
Button("Find") { showSearch() }
.keyboardShortcut("f", modifiers: .command)
Add custom menus to the menu bar via .commands { } on a Scene:
WindowGroup {
ContentView()
}
.commands {
CommandMenu("Items") {
Button("New Item") { createItem() }
.keyboardShortcut("n", modifiers: .command)
Button("Duplicate") { duplicateItem() }
.keyboardShortcut("d", modifiers: .command)
Divider()
Button("Delete") { deleteItem() }
.keyboardShortcut(.delete, modifiers: .command)
}
}
.commands {
CommandGroup(after: .newItem) {
Button("New from Template") { newFromTemplate() }
.keyboardShortcut("t", modifiers: [.command, .shift])
}
}
| Action | Shortcut | |--------|----------| | New | Cmd+N | | Save | Cmd+S | | Delete | Cmd+Delete | | Find | Cmd+F | | Select All | Cmd+A | | Undo | Cmd+Z | | Preferences | Cmd+, |
.keyboardShortcut()CommandMenu for app-specific menus, CommandGroup to extend system menusCommandMenu and CommandGroup go inside .commands { } modifier on a Scene — NEVER directly in @SceneBuilder bodytesting
Use for 3D games: racing, 3D sports, board games, marble maze, tower defense, bowling. SceneKit + SceneView architecture, 3D scene hierarchy, physics, game loop, primitives, materials, cameras, particles, audio.
documentation
Game UI patterns: SwiftUI HUD overlays on SpriteKit, menus (main/pause/game-over), virtual joystick/d-pad, score displays, health bars, tutorial onboarding.
tools
Download free game sprites/textures/3D models and generate procedural assets. Covers nw_download_asset tool, texture factories, sprite atlas organization, 3D model loading, and programmatic asset creation.
testing
Use for 2D games: arcade, puzzle, sports, ping pong, platformer, shooter, 2D racing. SpriteKit + SpriteView architecture, scene hierarchy, physics, game loop, audio, particles, game feel.