Entering full immersion without grab bar and close icon

I'd like to enter a fully immersive scene without the grab bar and close icon.

The full immersion app that comes with Xcode doesn't exit the immersion state when "x" is hit, but all the grab etc disappears - if I could only do that programmatically!

I've tried conditionally removing the View that launches the ImmersiveSpace, but the WindowGroup seems to be the thing that puts out the UI I'm trying to hide...

WindowGroup { if(gameState.immersiveSpaceOpened){ ContentView() .environmentObject(gameState) } }

Answered by matthewfromkaty in 789478022

The answer is to call the dismiss window action after opening the Immersive Space. Seems obvious now

@Environment(\.dismissWindow) var dismissWindow

switch await openImmersiveSpace(id: "UnderseaSpace") {
                        case .opened:
                            immersiveSpaceIsShown = true
                            dismissWindow()
Accepted Answer

The answer is to call the dismiss window action after opening the Immersive Space. Seems obvious now

@Environment(\.dismissWindow) var dismissWindow

switch await openImmersiveSpace(id: "UnderseaSpace") {
                        case .opened:
                            immersiveSpaceIsShown = true
                            dismissWindow()
Entering full immersion without grab bar and close icon
 
 
Q