How it works
FullImmersionStyle is a concrete immersion style for visionOS that hides the passthrough view of the wearer's physical surroundings and presents your content as the only thing they see. It conforms to the ImmersionStyle protocol, so you don't construct it directly with a custom initializer; instead you select it through the static accessor full and hand it to an immersive space. Reach for it when an experience should take over the wearer's environment completely — a virtual world, a planetarium, a fully rendered scene — rather than blending content into the real room the way mixed or progressive immersion does.
Refer to the style through the .full accessor
FullImmersionStyle is surfaced as a static member on ImmersionStyle, so you spell it as the leading-dot shorthand
.fullrather than calling an initializer. Because the property's type is the existentialany ImmersionStyle, the samestylevalue can hold any style, while.fullpins it to full immersion:@State private var style: any ImmersionStyle = .full.Apply it with immersionStyle(selection:in:)
The
.immersionStyle(selection:in:)modifier is where the style takes effect. Theselectionargument is a binding to your current style and theinargument lists the styles the scene is allowed to use; passing.fullfor both —.immersionStyle(selection: $style, in: .full)— declares that this content runs fully immersed.Bind selection so the system can drive the style
Because
selectiontakes a Binding, you pass$stylerather than the plain value. This lets the runtime read and write the active style, so the immersion can change in response to the experience while the boundstylestate stays the source of truth for FullImmersionStyle being active.List the permitted styles in the in: parameter
The
in:parameter enumerates every style the space may switch among; listing only.fullconstrains the experience to full immersion alone. To offer choices you would widen this list (for example to also include.mixedor.progressive), and the binding inselectionwould then move between them.
in: argument from .full to .mixed in .immersionStyle(selection: $style, in: .full) and watch the surroundings reappear through passthrough instead of being fully replaced.Example & preview
Press Run live & edit to compile it in your browser — then edit the Swift on the left and the preview re-renders live.
struct FullImmersionStyleDemo: View {
@State private var style: any ImmersionStyle = .full
var body: some View {
VStack(spacing: 16) {
Image(systemName: "visionpro")
.font(.system(size: 44))
Text("Full Immersion")
.font(.headline)
Text("Replaces your surroundings entirely.")
.font(.caption)
.foregroundStyle(.secondary)
}
.padding()
.immersionStyle(selection: $style, in: .full)
}
}