← ClaudeAtlas

macos-app-no-xcodelisted

Build, sign, and ship a native SwiftUI macOS app (menu-bar accessory, floating island/HUD panels, GUI admin prompts, custom icns) from a single Swift file with swiftc — no Xcode project. Use when creating or iterating native Mac apps outside Xcode.
infinitule/apple-design-toolkit · ★ 3 · AI & Automation · score 61
Install: claude install-skill infinitule/apple-design-toolkit
# Native macOS App Without an Xcode Project Ship a real .app from one Swift file. Compile seconds, not minutes; the whole app is reviewable in a single source. ## Build + bundle ```bash swiftc -O main.swift -o MacPulse # top-level code REQUIRES the file be named main.swift APP="$HOME/Applications/MyApp.app" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" cp binary "$APP/Contents/MacOS/"; cp Info.plist "$APP/Contents/" cp AppIcon.icns resources... "$APP/Contents/Resources/" codesign --force --deep -s - "$APP" # ad-hoc is fine for local; required on Apple Silicon ``` Info.plist essentials: `CFBundleExecutable`, `CFBundleIdentifier`, `CFBundlePackageType=APPL`, `LSUIElement=true` (no Dock icon — island/menu-bar apps), `CFBundleIconFile=AppIcon`, `NSAppleEventsUsageDescription` if any osascript touches System Events. ## Floating island / HUD panel pattern - `NSPanel` with `[.borderless, .nonactivatingPanel]`, `level = .statusBar`, `isOpaque=false`, `backgroundColor=.clear`, `hasShadow=false` (draw shadow in SwiftUI), `isMovableByWindowBackground=true`, `collectionBehavior=[.canJoinAllSpaces, .fullScreenAuxiliary]`. - Override `canBecomeKey=true` + `keyDown` keyCode 53 for Esc. - Expansion: resize the WINDOW frame (anchor top-center: keep `midX`/`maxY`) in sync with a SwiftUI spring — set frame BEFORE expanding, AFTER (delayed ~0.42 s) when collapsing. A transparent oversized window blocks clicks underneath — size snugly. - Entry point without @main: