visionOS: Change how the initial immersion style is set

Set the initial style to be automatic, that's the default. With this
change we also get rid of the warnings shown on application startup
complaining about the application not defining an initial immersion
style:
"Since your app does not define an initial immersion style in its
Application Scene Manifest, the default immersion style will be
applied. This does not match the immersion style defined at runtime
'full'. To make sure your app's state matches its runtime behavior
define an initial immersion style."

Change-Id: I1b8bba5f919b72d4f2507a19a30de49e8bfcd708
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 08146377db8ce782bac5b9561338ba20f7101ac5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Strømme 2025-02-07 14:03:00 +01:00 committed by Qt Cherry-pick Bot
parent 8633c8e446
commit a234b472d7

View File

@ -9,6 +9,8 @@ import RealityKit
struct QIOSSwiftApplication: App {
@UIApplicationDelegateAdaptor private var appDelegate: QIOSApplicationDelegate
@State private var immersionStyle:ImmersionStyle = .automatic
var body: some SwiftUI.Scene {
WindowGroup() {
ImmersiveSpaceControlView()
@ -24,12 +26,7 @@ struct QIOSSwiftApplication: App {
}
}
}
// CompositorLayer immersive spaces are always full, and should not need
// to set the immersion style, but lacking this we get a warning in the
// console about not being able to "configure an immersive space with
// selected style 'AutomaticImmersionStyle' since it is not in the list
// of supported styles for this type of content: 'FullImmersionStyle'."
.immersionStyle(selection: .constant(.full), in: .full)
.immersionStyle(selection: .constant(immersionStyle), in: immersionStyle)
}
}