Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add tomkrikorian/visionOSAgents --skill "spatial-swiftui-developer"
Install specific skill from multi-skill repository
# Description
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.
# SKILL.md
name: spatial-swiftui-developer
description: 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.
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 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.
Information About the Skill
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.
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 omit
defaultSizefor volumes; physical scale will be inconsistent.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.