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.

  1. Which SwiftUI scene types exist on which platform (Settings, MenuBarExtra, Window, DocumentGroup, WindowGroup(for:)), and how do you share an App? 20.9.1 · L3
    Compiling the same scene for each destination gives this map. WindowGroup { } exists everywhere, including tvOS and watchOS. WindowGroup(for:) (a window per…
  2. 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? 20.9.2 · L3
    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.

  1. How do windows, volumes and immersive spaces fit together in SwiftUI on visionOS: ornaments, openImmersiveSpace, immersion styles, and what only compiles there? 20.9.3 · L3
    The scene vocabulary is SwiftUI’s with three additions. A WindowGroup is a 2D window (use glassBackgroundEffect() for the system material and…
  2. How do a Swift package’s platforms declaration and its dependants interact, and how do you build the same package for every destination? 20.9.4 · L3
    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