Develop your first immersive app

Develop your first immersive app

This video goes over creating an immersive view using Xcode, Simulator, and Reality Composer Pro. It is a great way to get familiar with the development environment.

Create an Xcode Project

  • Types of initial VisionOS Projects
  • Select an Initial Scene with Volumes and No Immersive Space
    • First file is MyFirstImmersiveApp has a WindowGroup
      • WindowGroup specifies the top level SwiftUI views that your app presents
    • Second file is ContentView hold most of the code displayed by WindowGroup
      • Two Views RealityView and ToggleView
        • RealityView generates content in the first parameter and updates content on SwiftUI state change in the second parameter. Gesture added to RealityView to allow tap on entity to toggle - For more see Build spatial experiences with RealityKit

Simulator

  • How to use the simulator.
    • Viewing Controls
    • The toolbar for different scenes
    • For more info: https://developer.apple.com/documentation/visionos/interacting-with-your-app-in-the-visionos-simulator

Xcode Previews

  • Use to quickly preview the SwiftUI View Changes

Reality Composer Pro

Create an Immersive scene

  • Add Immersive Space to MyFirstImmersiveApp below the WindowGroup and display ImmersiveView()
  • Create ImmersiveView() to be displayed
  • Create button to open ImmersiveView() in ContentView()

Target gestures to entities

  • use “.gesture(TapGesture().targetedToAnyEntity().onEnded { value in” on entity with CollisionComponent and InputTargetComponent
  • Add the CollisionComponent and InputTargetComponent using the RealityComposerPro
  • Add code to the RealityView to move clouds

Notes mentioning this note


Here are all the notes in this garden, along with their links, visualized as a graph.