From a234b472d7bab8eda218ff5644ccee8b2011ee60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Fri, 7 Feb 2025 14:03:00 +0100 Subject: [PATCH] visionOS: Change how the initial immersion style is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø (cherry picked from commit 08146377db8ce782bac5b9561338ba20f7101ac5) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/ios/qiosapplication.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/ios/qiosapplication.swift b/src/plugins/platforms/ios/qiosapplication.swift index cf4ea03de64..9cbd8307551 100644 --- a/src/plugins/platforms/ios/qiosapplication.swift +++ b/src/plugins/platforms/ios/qiosapplication.swift @@ -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) } }