Restoring visionOS windows to spatial location upon returning from immersive scene

If I have windows that occupy the shared space and are located in various spatial locations for the user, say various rooms in a home, how do I have those windows reappear/open in the same spatial location when the user returns to the shared space after being in a full immersive space? I assume it has to do with somehow setting the state of the windows before heading into the immersive view, but I’m not sure how to begin thinking about this or the type of code I would need for that. Any help for this question would be appreciated.

New in visionOS 2.0 is window and scene restoration. You can use the typical UIKit or SwiftUI state restoration techniques that you use on other platforms.

Check out the new restorationBehavior(_:) modifier for Scene, and the sample code for Restoring Your App’s State with SwiftUI

I’ll look into this. This might be what I need. For now, I went ahead and submitted a Feedback suggestion: FB13871808 (Restoring visionOS windows to spatial location upon returning from immersive scene)

Restoring visionOS windows to spatial location upon returning from immersive scene
 
 
Q