Spatial SwiftUI Designer (visionOS)
Overview
Use this skill to design SwiftUI-based spatial interfaces that embed RealityKit content on visionOS and to choose the right SwiftUI entry points for 3D presentation.
Quick start workflow
- Identify the presentation surface:
WindowGroup, volumetric window, orImmersiveSpace. - Choose a 3D API:
Model3Dfor simple models,RealityViewfor full RealityKit scenes. - Load RealityKit content asynchronously and add entities in the
RealityViewmake closure. - Use RealityView attachments to place SwiftUI UI in 3D space when needed.
- Add spatial interaction with
SpatialTapGestureor entity-targeted gestures. - Update RealityKit content in the
RealityViewupdate closure, not in SwiftUI body. - Validate scale using
defaultSizefor volumes andimmersionStylefor immersive spaces.
Core concepts
Scene and spatial presentation
- Use
WindowGroupwithwindowStyle(.volumetric)anddefaultSizefor volumes. - Use
ImmersiveSpacefor unbounded spatial scenes andimmersionStyleselection. - Use
openImmersiveSpaceanddismissImmersiveSpacefor transitions.
RealityKit embedding in SwiftUI
- Use
RealityViewfor full RealityKit scenes and per-frame updates. - Use
Attachmentand RealityView attachments to embed SwiftUI views in 3D. - Use
ViewAttachmentEntityandViewAttachmentComponentfor attachment entities.
3D model presentation
- Use
Model3Dfor async model loading with SwiftUI layout. - Use
Model3DPhaseandModel3DAssetfor loading phases and animation choices.
Spatial input
- Use
SpatialTapGesturefor spatial tap locations in 2D/3D coordinate spaces.
Implementation patterns
- Use
Model3Dwhen you only need display and layout; useRealityViewfor custom entity graphs and systems. - Keep RealityKit mutations inside
RealityViewmake/update closures. - Prefer attachments for UI that should remain SwiftUI-driven but positioned in 3D.
- Treat
ImmersiveSpaceas a separate scene with its own lifecycle and environment actions.
Pitfalls and checks
- Do not block the main actor with synchronous model or entity loading.
- Do not update RealityKit entities inside SwiftUI body computation.
- Do not use volumetric window style with
Windowinstead ofWindowGroup. - Do not omit
defaultSizefor volumes; physical scale will be inconsistent.
References
- references/REFERENCE.md - index of feature-focused code patterns.
- references/model3d.md - Model3D loading, assets, animation, and manipulable.
- references/realityview.md - RealityView setup, attachments, and RealityKit patterns.
- references/interaction.md - Gestures and manipulation patterns for spatial input.
- references/windowing-immersion.md - Window management and immersive space patterns.
- references/spatial-layout.md - SwiftUI spatial layout APIs and debug tools.
- references/charts-3d.md - Chart3D and surface plot patterns.