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.
The code for this tutorial can be found in the repository linked below on the 101/opening-multiple-windows branch.
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
Windows and Volumes require identifiers to be able to be opened in VisionOS.
Step Two: Create the Entities
Create new files for the windows and volumes.
Step Three: Add to the App
Add the entities created in step two to the app.
Step Four: Update the Main Window
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
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.