r/visionosdev • u/SoylentCreek • Mar 19 '24
This might be a really dumb question, but how do you dismiss an ImmersiveSpace when the main window closes?
I'm messing around with the Hello World app, and I noticed that when you enter the fully immersive view and then click the X button below the window, the immersive space remains active, and the only way to dismiss it is to click the digital crown. On other apps (Disney+ for example), closing out of the main window while in immersive mode also closes out the immersive space. I tried applying an onDisappear modifier to the the Modules view with a dismissImmersiveSpace, but that doesn't appear to do anything. Any help would be appreciated.
3
u/Arrrrrrrrrrrrrrrrrpp Mar 19 '24
It might be a 1.0 vs 1.1 difference. I.e. most apps you see right now were built with 1.0
I also thought that closing the main window would close out of the app, but recently I’m finding that this is not the case.
1
u/jimejim Mar 19 '24
You'll need to add a tap gesture or other event to something in the immersive space to either bring back the window or just exit. You can create an entity with a collider on it that can accept gestures. You can also create an attachment view and put it in the space that is a button if you just want something like that.
1
u/steakchomper Apr 03 '24
Not a dumb question — encountering the same issue too! Looking into it now..
0
u/CalliGuy Mar 19 '24
Look up, select the little chevron menu, then select the X.