How to open multiple windows and volumes in VisionOS

To open multiple windows or volumes, add the volumes and windows with unique identifiers to the app and use the openWindow environment variable within a button.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 08/08/2024 at 14:23
Last Updated on 08/13/2024 at 12:17
<p>A flower that represents VisionOS with the text “Open Multiple Windows &amp; Volumes” beneath it.</p>

To open multiple windows or volumes, add the volumes and windows with unique identifiers to the app and use the openWindow environment variable within a button.

SubscribeWhat are Windows in Spatial Computing?What are Volumes in Spatial Computing?

The code for this tutorial can be found in the repository linked below on the 101/opening-multiple-windows branch.

Download Open Source VisionOS Starter Project

Please note that this tutorial demonstrates that you can open multiple versions of the same window and volume, as long as they are present in the app with an associated identifier.

Step One: Create the Identifiers

<p>A screenshot of XCode showing how we created identifiers in a struct using UUIDs.</p>

Windows and Volumes require identifiers to be able to be opened in VisionOS.

Step Two: Create the Entities

<p>A screenshot of XCode showing the sample window and volume that we created.</p>

Create new files for the windows and volumes.

Step Three: Add to the App

<p>A screenshot of XCode showing how we added the windows and volumes to the VisionOS app.</p>

Add the entities created in step two to the app.

Step Four: Update the Main Window

<p>A screenshot of XCode showing how we updated the main window to use the openWindow environment variable and how its used to open windows and volumes through buttons found on the window.</p>

Add the openWindow environment variable to the main window.

Then use a button to open the window or volume but calling the environment variable along with the identifier.

Step Five: Test

<p>A screenshot of the simulator showing multiple windows and volumes.</p>

Run the app and confirm that everything works as expected.

Looking to learn more about VisionOS, Spatial Computing, Design and Technology?

Search our blog to learn more about visionOS, spatial computing, design and technology.

Search our Blog

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe