Meet SwiftUI for Spatial Computing 

This is a high-level review of SwiftUI’s extensions for xrOS 

All of xrOS was built in SwiftUI

Buttons can provide audio feedback when pressed.  With Spatial computing we have to use Scenes, see the three types defined in other sessions – Window, Volume, and Full Space. 

Breaking down the structure of a windows

  • Start with glass background
  • Within that you have same navigation containers – like TabView, and SplitView with Navigation and Lists
  • Using labels for tabs, they will be exposed when hovered.
  • Ornaments are new – and provide an overlay on the bottom edge of a window (with slight overlap)
  • You should use various Material treatments to the background of windows – this will then dynamically adjust base on the background etc.

Interactions

  • Eyes, by looking
  • Hands, reach out to touch
  • Pointer, connected track pad keyboard, etc.
  • Accessibility, supports all the controls from other platforms

Hover effects:

  • Critical to make your app responsive and assist with targeting
  • Added automatically to most controls.  If you create your own custom controller style, you want to add this
    • I will have to correct my custom button style in Wasted Time
    • Just add .hoverEffect() to your button style
  • Elevate your windowed app for Spatial computing (session to watch)

Volumes:

  • Just change .windowStyle(.volumetric) and you can set a .defaultSize(
  • Model3D is similar to image but always loads async – and it is also just another SwiftUI View
  • If you add a ZStack around a Model3D – it will be aware of the content space and depth.
  • You can add .padding3D(.front, 200)
  • You can also use .glassBackgroundEffect(in:
  • You can add .rotation3DEffect(rotation, axis: .y)
  • You can use RealityView to provide full access to RealityKit content 
  • Check out “Build Spatial experience with RealityKit”
  • Gestures and attachments are enabled with RealityView
  • “Take SwiftUI to the next Dimension”

Full Spaces:

  • Gives you full control of the environment.
  • Just add ImmersiveSpace(id: ) { View() } 
  • You can adjust immersion styles and transition between them on the style.  Mixed, Full, and Progressive (middle ground)
  • You can use ARKit to make your space even more interactive and use physics with the real world.
  • There’s a deep dive in Go Beyond the Window with SwiftUI