20.9 · Which scenes, modifiers and spaces exist where, and how a package declares them
A matrix of SwiftUI scene types and modifiers per platform, checked with the compiler, plus the visionOS scene types and how SwiftPM reports platform mismatches.
Mental model. Treat availability as a table you can regenerate by compiling, not a thing you remember.
Scenes and modifiers
Which scenes and view modifiers compile where.
- Which SwiftUI scene types exist on which platform (
Settings,MenuBarExtra,Window,DocumentGroup,WindowGroup(for:)), and how do you share anApp?
Compiling the same scene for each destination gives this map. WindowGroup { } exists everywhere, including tvOS and watchOS. WindowGroup(for:) (a window per… - Which common view modifiers are platform specific (
navigationBarTitleDisplayMode,onHover,hoverEffect,focusSection, the tvOS remote commands,digitalCrownRotation), and how do you write a view that compiles everywhere?
Type-checking one view per modifier, the results are: navigationBarTitleDisplayMode compiles on iOS, watchOS and visionOS and is unavailable on tvOS and macOS.…
Spaces and packages
visionOS scene APIs and a multi-platform SwiftPM setup.
- How do windows, volumes and immersive spaces fit together in SwiftUI on visionOS: ornaments,
openImmersiveSpace, immersion styles, and what only compiles there?
The scene vocabulary is SwiftUI’s with three additions. A WindowGroup is a 2D window (use glassBackgroundEffect() for the system material and… - How do a Swift package’s
platformsdeclaration and its dependants interact, and how do you build the same package for every destination?
A package lists the minimum OS per platform it supports: platforms: [.iOS(.v17), .macOS(.v14), .tvOS(.v17), .watchOS(.v10), .visionOS(.v1)]. A package that…
More in Multiplatform Apple
- 20.1 · Shared cores, platform conditions, capabilities, and the release train
- 20.2 · Documents, scenes and windows on iPad
- 20.3 · Catalyst, native AppKit and SwiftUI on the Mac, and the Mac’s sandbox and menus
- 20.4 · The focus engine, the remote and the 10-foot UI, and media-first apps
- 20.5 · Input and battery, on-watch health and networking, and the dual-target setup
- 20.6 · Windows, volumes and immersive spaces
- 20.7 · What the compiler and the runtime say about each platform
- 20.8 · The Mac sandbox, signing, bookmarks, menus and Catalyst, measured