Mac
Multiple windows, menus, keyboard shortcuts and files.
System surfaces: App Intents · Widgets · Spotlight · Controls
- ★ One model per window, and menus that find it. Each window owns its own model
and publishes it with
focusedSceneValue. Menu commands in.commandsread the frontmost window's model with@FocusedValue. It takes about ten lines. - ★ Files are a front door. File › Open… (⌘O) through
fileImporter, and drag-and-drop that accepts file URLs (more than one) through the same code path. Picker, ⌘O and drop should all end in one loader. - ★ Drag out, too. People expect to drag your result onto the desktop or into another app.
- ★ Keyboard shortcuts live in the menus, not only on buttons. A shortcut on a button can't be found in the menu bar.
- Settings is a ⌘, window (a
Settingsscene), not a sheet over your content. - Give windows a real minimum size with
.windowResizability(.contentMinSize), or people can drag the window smaller than its content. - The sandbox:
fileImporterneeds user-selected-file read access, and every read of a URL you were handed (dropped files too) needs security-scoped access. - Ask for less. Saving to Photos works with add-only access (
.addOnly). - Swift 6 trap: with default MainActor isolation, a Photos
performChangesclosure written inline inherits@MainActorand traps when Photos calls it off the main thread. Build the closure in anonisolatedfunction that returns a@Sendableclosure. - Widgets and Controls (Controls from macOS 26). Your iPhone app's widgets
can show up on the Mac even if you have no Mac app (WidgetKit's
iPhoneWidgetsOnMaclocation, iOS 17). - Keep the engine free of UI. A package with no UIKit, AppKit or SwiftUI import
(render to
CGImage, show withImage(decorative:scale:)) is what makes the Mac cheap.
First test: run your iPad app on an Apple silicon Mac and list everything that feels un-Mac. That's your to-do list.
References
Design
- Designing for macOS (Human Interface Guidelines)
- Windows
- The menu bar
- Drag and drop
- File management
- Settings
Documentation
- Bringing multiple windows to your SwiftUI app
focusedSceneValue(_:_:),FocusedValueandCommandsSettingswindowResizability(_:)fileImporter,draggable(_:)anddropDestination(for:action:isTargeted:)- Accessing files from the macOS App Sandbox
PHAccessLevel.addOnlyWidgetLocation.iPhoneWidgetsOnMac
Watch
- Code-along: Build powerful drag and drop in SwiftUI (WWDC26)
- Use SwiftUI with AppKit and UIKit (WWDC26)
- Modernize your AppKit app (WWDC26)
- Get ready for Touch on Mac, with the Tech Talks Design for touch on Mac, Bring Touch to your Mac app and Bring Live Activities to Mac