Your First VisionOS App

Dervis Yılmaz
4 min readJun 27, 2023

--

Hello everyone, I am very excited to write this blog because this is my first post on Medium. I was looking forward to discovering the simulator about VisionOS and participating in its immersive experiences. In this blog, I’ll outline the prerequisites for running your first VisionOS app and provide a comprehensive guide on building your first app.

System Requirements :

  • MacOS Ventura 13.4.1
  • Xcode 15.0 Beta 2
  • Vision 0S Simulator

Most of the things above can be downloaded from the Apple developer site. Please download the Xcode, install it, and get the tools and Vision OS Simulator.

  • Open Xcode -> New project -> Choose vision OS
  • Click on the next Tab -> You may see a window creating the project name and other details. Change the identifier to your/company name and choose your immersive experience

Next” button, select the desired location to save your application, and once you’ve done that, you’ve successfully set up your first VisionOS app.

So what's next? Let's experience the simulator now.

Making a VisionOS project is quite easy, and you can start making VisionOS apps right away using your existing SwiftUl knowledge.

Now let’s look at a few basics.

To add a FullSpace, simply add an ImmeriveSpace Scene with ID in the App Scene, and with the ID, we can call it just like we call Windows in SwiftUI. There are three types of Immersion styles available:

1. Mixed: Where the User co-exists with the real world

2. Progressive: It’s a middle ground where the Immersion level can be controlled by the digital crown.

3. Full: Becomes Fully Immersive and hides the people’s surroundings.

Opening an Immersive space is just like calling an OpenWindow environment in SwiftUl. Simply present or dismiss Immersive Space with its ID using the openlmmersiveSpace and dismissimmersiveSpace environment values.

Let’s look at some new views and modifiers that are added for VisionOS.

Model3D is a new view that allows us to define 3D models in the
the same way we used to show URL images using Asynclmage in SwiftUl.

Do you remember Canvas with Symbols, where we define symbols with hashtags and use them inside the canvas? Just like that, we can define the SwiftUl views as attachments and use them inside our RealityView. RealityView is another way to display 3D models, including RealityKit content authored in Reality Composer Pro. It also offers more advanced features.

VisionOS Exclusive Modifiers

  • glassBackgroundEffect() — Displays a glass background with glass
    material for the applied SwiftUl View.
  • ornament() — Attaching a given SwiftUl View outside the SwiftUl window
  • offset(z:) — Moves the view in the Z-axis, which is front/back.
  • rotation3DEffect(Rotation3D:) — 3D models can be rotated using this
    modifier (applicable to SwiftUl View too).
  • SpatialTapGesture() — Used to recognize taps on a SwiftUl View.
  • DragGesture now returns translation in 3D to manage gestures in 3D Space.

You can download the source code https://github.com/dervisyilm/FirstVisionOSApp

Discover VisionOS

https://developer.apple.com/visionos/

--

--