visionOS sample architecture
Source-backed, high-level architecture notes for Apple sample-code pages grouped in the visionOS folder.
- Catalog module label:
visionOS - Coverage: 56 / 56 sample pages documented
- Source policy: archive hashes and extracted-tree references are verified locally before analysis
Samples
| Sample | Platforms | High-level architecture | Documented patterns |
|---|---|---|---|
| Accessing the main camera | visionOS | A Swift sample with the source-visible chain AccessingTheMainCameraApp → ContentView → CameraSessionManager → SwiftUI / ARKit APIs. |
— |
| Adding a depth effect to text in visionOS | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → SwiftUI APIs. |
— |
| Animating hand models in visionOS | visionOS | A Swift sample with the source-visible chain AnimatingHandModelsApp → ContentView → AppModel → SwiftUI / ARKit APIs. |
— |
| Applying mesh to real-world surroundings | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → MeshAnchorGenerator → SwiftUI / ARKit APIs. |
— |
| Associating a window with an immersive space | visionOS | A Swift sample with the source-visible chain SampleApp → ContentView → AppModel → SwiftUI / RealityKit APIs. |
— |
| BOT-anist | iOS, iPadOS, Mac Catalyst, macOS, visionOS | A Swift sample with the source-visible chain BOTanistApp → ContentView → PlantAnimationProvider → RealityKit / SwiftUI APIs. |
— |
| Building an immersive media viewing experience | visionOS | A Swift sample with the source-visible chain DestinationVideo → ContentView → Coordinator → EnvironmentStateHandler → SwiftUI / SwiftData APIs. |
Delegate or data-source callbacks, Coordinator |
| Building local experiences with room tracking | visionOS | A Swift sample with the source-visible chain ARKitRoomTrackingApp → ContentView → RealityKit / SwiftUI APIs. |
— |
| Canyon Crosser: Building a volumetric hike-planning app | visionOS | A Swift sample with the source-visible chain CanyonCrosserApp → ContentView → AppModel → ClippingMarginPercentageSystem → SwiftUI / RealityKit APIs. |
Protocol-oriented abstraction, Binding-based state propagation |
| Chaparral Village: Building an immersive visionOS adventure game | visionOS | A thin visionOS app target (ChaparralVillageApp, ContentView) on top of one local Swift package, RCPCustomComponents. The package holds the game logic as RealityKit components, systems, and scene-scoped SceneBound manager objects. |
Entity-component-system composition, Scene-scoped registry, SwiftUI environment injection, Protocol-oriented abstraction, Observer |
| Connecting iPadOS and visionOS apps over the local network | iOS, iPadOS, Mac Catalyst, visionOS | A Swift sample with the source-visible chain CompanionApp → ServerContentView → RobotViewModel → Client → SwiftUI / PeerToPeerMessaging APIs. |
Model-View-ViewModel, Protocol-oriented abstraction, Actor isolation |
| Creating 2D shapes with SwiftUI | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → SwiftUI APIs. |
— |
| Creating 3D entities with RealityKit | visionOS | A Swift sample with the source-visible chain EntryPoint → ShapesView → RealityKit / SwiftUI APIs. |
— |
| Creating 3D models as movable windows | visionOS | A Swift sample whose EntryPoint entry flows through VolumetricWindow before reaching SwiftUI / RealityKit APIs. |
— |
| Creating a 3D painting space | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → ClosureSystem → RealityKit / SwiftUI APIs. |
Publisher-backed observable state |
| Creating a navigation mesh with Reality Composer Pro | iOS, iPadOS, Mac Catalyst, macOS, visionOS | A two-file SwiftUI shell. RCPNavigationMeshApp starts the RealityKitScripting runtime and opens an immersive space (visionOS) or a window (other platforms). ContentView loads one exported scene into a RealityView and forwards input to the scene’s script graphs. Gameplay is not written in Swift. |
— |
| Creating an immersive space in visionOS | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → TurnTableSystem → SwiftUI / RealityKit APIs. |
— |
| Creating an interactive 3D model in visionOS | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → SwiftUI / RealityKit APIs. |
— |
| Creating animation graphs with Reality Composer Pro and RealityKit | iOS, iPadOS, Mac Catalyst, macOS, visionOS | One WindowGroup hosts ContentView. That view loads the exported world scene, finds the owl_model entity, and mirrors two SwiftUI state values into the entity’s animation-graph parameters, moving and speed. The blend and state logic lives in the Reality Composer Pro animation graph, not in Swift. |
Binding-based state propagation |
| Creating SwiftUI windows in visionOS | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → SwiftUI APIs. |
— |
| Designing no-code games with Reality Composer Pro 3 | visionOS | One visionOS app target. SquirrelApp sets up the ScriptingRuntime and opens a volumetric window. ContentView loads the world entity, parents attachment views to anchor entities authored in the scene, subscribes to graph-raised events, and sends UI events back with scene.send(name:). |
Binding-based state propagation |
| Destination Video | iOS, iPadOS, Mac Catalyst, macOS, tvOS, visionOS | A Swift sample with the source-visible chain DestinationVideo → ContentView → Coordinator → EnvironmentStateHandler → SwiftUI / SwiftData APIs. |
Delegate or data-source callbacks, Coordinator |
| Diorama | visionOS | A Swift sample with the source-visible chain DioramaApp → ContentView → ViewModel → AttachmentsProvider → RealityKit / SwiftUI APIs. |
Model-View-ViewModel, Delegate or data-source callbacks |
| Displaying a 3D environment through a portal | visionOS | A Swift sample with the source-visible chain EntryPoint → UIPortalView → AppModel → SwiftUI / RealityKit APIs. |
— |
| Displaying a stereoscopic image | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → SwiftUI / RealityKit APIs. |
— |
| Displaying an entity that follows a person’s view | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → HeadPositionTracker → SwiftUI / RealityKit APIs. |
— |
| Displaying text in visionOS | visionOS | A Swift sample with the source-visible chain TextApp → MainView → SwiftUI APIs. |
— |
| Displaying video from connected devices | visionOS | A Swift sample with the source-visible chain DisplayConnectedVideoApp → ContentView → CaptureManager → AVFoundation / SwiftUI APIs. |
Delegate or data-source callbacks, Actor isolation |
| Drawing in the air and on surfaces with a spatial stylus | visionOS | One visionOS app target. SurfaceInkingApp owns two observable models (AppModel, StylusModel) and injects them into a settings window and an immersive space. The immersive view builds a DrawingDocument and a per-frame DrawingInputProvider. The document feeds two DrawingSource pipelines (curve smoothing, then mesh extrusion), and a RealityKit BrushSystem uploads the generated LowLevelMesh. |
SwiftUI environment injection, Binding-based state propagation, Entity-component-system composition, Protocol-oriented abstraction |
| Embedding controls in an immersive space | visionOS | A Swift sample with the source-visible chain SampleApp → ContentView → AppModel → SwiftUI / RealityKit APIs. |
— |
| Enabling video reflections in an immersive environment | visionOS | A Swift sample with the source-visible chain DestinationVideo → ContentView → Coordinator → EnvironmentStateHandler → SwiftUI / SwiftData APIs. |
Delegate or data-source callbacks, Coordinator |
| Exploring object tracking with ARKit | visionOS | A SwiftUI app with two scenes: a plain WindowGroup that hosts HomeView and an ImmersiveSpace that hosts ObjectTrackingRealityView. One @Observable AppState is shared by both scenes. It owns the ARKitSession and a ReferenceObjectLoader. Per-anchor RealityKit content is built by ObjectAnchorVisualization. |
Actor isolation, Binding-based state propagation |
| Gaussian splats on visionOS | visionOS | A Swift sample with the source-visible chain GaussianSplatsOnVisionOSApp → ContentView → SplatViewCoordinator → RealityKit / SwiftUI APIs. |
Coordinator |
| Generating procedural textures | visionOS | A Metal, Swift sample with the source-visible chain Drawable → DrawableView → ProceduralTextureGenerator → SwiftUI / RealityKit APIs. |
— |
| Handling the window life cycle with multiple scenes | visionOS | A Swift sample with the source-visible chain SampleApp → ContentView → AppModel → SwiftUI / PackageDescription APIs. |
— |
| Happy Beam | visionOS | A Swift sample with the source-visible chain HappyBeamApp → GameModel → Player → SwiftUI / RealityKit APIs. |
Publisher-backed observable state |
| Hello World | visionOS | A Swift sample with the source-visible chain WorldApp → ItemView → ViewModel → RotationSystem → SwiftUI / RealityKit APIs. |
Model-View-ViewModel, Binding-based state propagation |
| Implementing adjustable material | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → SwiftUI / RealityKit APIs. |
— |
| Implementing SharePlay for immersive spaces in visionOS | visionOS | A Swift sample with the source-visible chain SharePlayCubeApp → CubeImmersiveView → AppModel → GroupActivities / SwiftUI APIs. |
View-controller organization |
| Incorporating real-world surroundings in an immersive experience | visionOS | A Swift sample with the source-visible chain SceneReconstructionExampleApp → EntityModel → ARKit / RealityKit APIs. |
— |
| Locating and decoding barcodes in 3D space | visionOS | A Swift sample with the source-visible chain LocatingAndDecodingBarcodesApp → ContentView → AppModel → SwiftUI / RealityKit APIs. |
— |
| Manipulating entities with solid collisions | visionOS | A Swift sample with the source-visible chain ManipulateWithSolidCollisionsApp → ContentView → AppModel → ManipulateWithSolidCollisionsSystem → RealityKit / SwiftUI APIs. |
— |
| Monitoring fit and field of view fidelity | visionOS | A Swift sample with the source-visible chain VisualFidelityApp → ContentView → AppModel → SwiftUI / ARKit APIs. |
— |
| Object tracking with Reality Composer Pro experiences | visionOS | A Swift sample with the source-visible chain ObjectTrackingExperiencesSampleApp → ContentView → AppModel → FadeOutSystem → SwiftUI / RealityKit APIs. |
— |
| Obscuring virtual items in a scene behind real-world items | visionOS | A Swift sample with the source-visible chain EntryPoint → MainView → MeshAnchorGenerator → SwiftUI / ARKit APIs. |
— |
| Petite Asteroids: Building a volumetric visionOS game | visionOS | A C/Objective-C header, Metal, Swift sample with the source-visible chain PetiteAsteroids → ContentView → AppModel → AudioCueSystem → RealityKit / RealityKitContent APIs. |
— |
| Placing content on detected planes | visionOS | A Swift sample with the source-visible chain ObjectPlacementApp → HomeView → PersistenceManager → ModelLoader → RealityKit / SwiftUI APIs. |
— |
| Placing entities using head and device transform | visionOS | A Swift sample with the source-visible chain HeadTrackingApp → ImmersiveView → AppModel → FollowSystem → SwiftUI / ARKit APIs. |
— |
| Playing immersive media with RealityKit | visionOS | A Swift sample with the source-visible chain RealityKitImmersivePlaybackApp → ContentView → AppModel → SwiftUI / RealityKit APIs. |
— |
| Playing spatial audio | visionOS | A Swift sample with the source-visible chain EntryPoint → SpatialAudioView → SwiftUI / RealityKit APIs. |
— |
| Rendering Gaussian splats with RealityKit | iOS, iPadOS, Mac Catalyst, macOS, visionOS | One SwiftUI app with a small @Observable AppModel (loadedAsset, immersiveSpaceState). Compile-time #if os(...) picks the presentation: SpatialSplatView in an ImmersiveSpace on visionOS, or WindowSplatView inside ContentView on iOS and macOS. Both views call the same free-function loaders and entity builder. |
SwiftUI environment injection, Observable state, SwiftUI–RealityKit bridge, Platform-conditional view variants |
| Swift Splash | visionOS | A Swift sample with the source-visible chain SwiftSplashApp → ContentView → SoundEffectPlayer → RealityKit / SwiftSplashTrackPieces APIs. |
Actor isolation |
| Synchronizing custom video playback with SharePlay | visionOS | SwiftUI scenes read one environment-injected AppModel. That model holds a PlaybackSessionController for the app’s lifetime. For each GroupSession, the controller builds a fresh pair: a PlaybackCoordinator for outbound and inbound SharePlay commands, and a PlaybackRenderer that applies those commands to a local synchronizer. |
SwiftUI environment injection, Observable state owner, Playback facade, delegate-to-async adapter, Actor isolation, Sample-buffer video bridge |
| Tracking and visualizing hand movement | visionOS | A Swift sample with the source-visible chain HandTracking → MainView → HandTrackingSystem → ARKit / RealityKit APIs. |
— |
| Tracking specific points in world space | visionOS | A Swift sample with the source-visible chain ObjectPlacementApp → HomeView → PersistenceManager → ModelLoader → RealityKit / SwiftUI APIs. |
— |
| Working with generic spatial accessories | visionOS | A Swift sample with the source-visible chain WorkingWithGenericSpatialAccessoriesApp → ContentView → AccessoryModel → SwiftUI / RealityKit APIs. |
— |
Cross-sample signals
Recurring documented patterns
| Pattern label | Sample documents |
|---|---|
| Binding-based state propagation | 6 |
| Delegate or data-source callbacks | 5 |
| Actor isolation | 5 |
| Coordinator | 4 |
| Protocol-oriented abstraction | 4 |
| SwiftUI environment injection | 4 |
| Model-View-ViewModel | 3 |
| Entity-component-system composition | 2 |
| Publisher-backed observable state | 2 |
Type-role naming evidence
Counts below are declaration-name suffixes, not inferred patterns.
| Role suffix | Distinct declarations across samples |
|---|---|
View |
248 |
System |
104 |
Component |
95 |
App |
36 |
Model |
36 |
Manager |
21 |
Handler |
17 |
Coordinator |
10 |
Generator |
5 |
Delegate |
5 |
Provider |
4 |
Tracker |
4 |
Observer |
3 |
Controller |
3 |
Player |
3 |
ViewModel |
3 |
Loader |
3 |
Command |
2 |
Client |
1 |
Document |
1 |
Swift access-control evidence
These are declaration occurrences in scanned Swift source, including implicit internal declarations.
| Access level | Occurrences |
|---|---|
implicit internal |
9255 |
private |
1735 |
public |
1568 |
private(set) |
86 |
fileprivate |
60 |
internal |
14 |
References
Generated from the verified local catalog and completed Markdown documents.