> spatial-swiftui-developer
Design and implement visionOS SwiftUI scenes that integrate RealityKit content. Use when building spatial UI with RealityView, Model3D, attachments, volumetric windows, ImmersiveSpace, or spatial gestures, or when choosing SwiftUI vs RealityKit APIs for 3D presentation.
curl "https://skillshub.wtf/tomkrikorian/visionOSAgents/spatial-swiftui-developer?format=md"Spatial SwiftUI Developer
Description and Goals
This skill provides guidance for designing and implementing visionOS SwiftUI scenes that integrate RealityKit content. It helps you choose between SwiftUI and RealityKit APIs for 3D presentation and shows how to bridge between the two frameworks effectively.
Goals
- Enable developers to build spatial UI experiences on visionOS
- Guide selection between SwiftUI and RealityKit APIs for 3D content
- Show how to integrate RealityKit content into SwiftUI scenes
- Demonstrate spatial interaction patterns with gestures
- Support proper windowing and immersion patterns
What This Skill Should Do
When building spatial UI with SwiftUI on visionOS, this skill should:
- Guide presentation surface selection - Help you choose between WindowGroup, volumetric windows, and ImmersiveSpace
- Select 3D APIs - Show when to use Model3D vs RealityView for different use cases
- Integrate RealityKit - Demonstrate how to load and embed RealityKit content in SwiftUI
- Handle spatial interaction - Provide patterns for spatial gestures and entity-targeted interactions
- Manage lifecycle - Ensure proper async loading and state management
Load the appropriate reference file from the tables below for detailed usage, code examples, and best practices.
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 either
AttachmentplusRealityViewAttachments.entity(for:)orViewAttachmentComponentto 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. - Use
defaultSizewhen you want a predictable initial volumetric size, and useimmersionStyleto configure immersive spaces.
Information About the Skill
Core Concepts
Scene and Spatial Presentation
- Use
WindowGroupwithwindowStyle(.volumetric)for volumes. AdddefaultSizewhen you want a predictable initial size, but treat it as a hint rather than a hard guarantee. - 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.
Reference Files
| Reference | When to Use |
|---|---|
REFERENCE.md | When looking for feature-focused code patterns and general guidance. |
model3d.md | When using Model3D for async model loading, assets, animation, and manipulation. |
realityview.md | When setting up RealityView, attachments, and RealityKit integration patterns. |
interaction.md | When implementing gestures and manipulation patterns for spatial input. |
windowing-immersion.md | When managing windows and immersive space patterns. |
spatial-layout.md | When using SwiftUI spatial layout APIs and debug tools. |
charts-3d.md | When implementing Chart3D and surface plot patterns. |
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 treat
defaultSizeas a hard requirement or guaranteed final size; the system can clamp or restore window geometry. - Use
.glassBackgroundEffect()when you want the system glass treatment on visionOS, and use custom backgrounds deliberately when the design needs a different visual language.
> related_skills --same-repo
> visionos-widgetkit-developer
Build and debug WidgetKit widgets for Apple Vision Pro (visionOS), including mounting styles (elevated/recessed), textures (glass/paper), proximity-aware layouts via LevelOfDetail, and timeline update troubleshooting.
> visionos-immersive-media-developer
Implement immersive and spatial video experiences on Apple Vision Pro (visionOS), including RealityKit VideoPlayerComponent setup, portal/progressive/full immersive viewing modes, transitions and events, comfort mitigation, and Apple Immersive Video authoring workflows.
> usd-editor
Guide for modifying USD ASCII (.usda) files, including prims, properties, composition arcs, variants, and transforms. Use when editing or reviewing .usda files by hand.
> tkr-skill-writer
Guide for creating and structuring skills with consistent formatting, clear documentation, and proper reference organization. Use when creating new skills or updating existing skill documentation.