Thanks -- this was helpful in zero-ing in on how to hide the main window.
However, one thing I noticed is that this doesn't work if you try to open the immersive experience from .onAppear. Not sure if I'm failing to bind the bool (e.g., model.isShowingSolar) somehow, as I'm new to SwiftUI. Hopefully, this helps someone!
For example:
var body: some View {
VStack(alignment: .center, spacing: XPPadding.regular) {
// tapping this button successfully toggles the opacity bool trigger.
Button("Test") {
Task {
await openImmersiveSpace(id: XPSpaceId.exam)
}
}
}
.onAppear {
// unfortunately, this did not toggle the opacity bool trigger.
Timer.scheduledTimer(withTimeInterval: 3, repeats: false) { _ in
Task {
await openImmersiveSpace(id: XPSpaceId.exam)
}
}
}
}