Presenting immersive content in UIKit app

I have a UIKit app and would like to provide spacial experience when run on VisionOS.

I added VisionOS support, but not sure how to present an immersive view. All tutorials are in SwiftUI, but my app is in UIKit.

This is an example from a SwiftUI project, but how how do I declare this ImmersiveView in UIKit?

struct VirtualApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }.windowStyle(.volumetric)
        
        ImmersiveSpace(id: "ImmersiveSpace") {
            ImmersiveView()
        }
    }
}

and in UIKit how do I make the call to open the ImmersiveView?

Post not yet marked as solved Up vote post of fullmoon14 Down vote post of fullmoon14
1.1k views

Replies

Maybe this will help: https://developer.apple.com/wwdc23/111215

  • Awesome, thank you I'll check it out.

Add a Comment

@fullmoon14 , as @mikebernardo2000 pointed out, that video will help. For anyone following along, refer to Outside: RealityKit at 21:51 of Meet UIKit for spatial computing. This describes how to use RealityView within UIHostingController to host the RealityKit SwiftUI views within your UIKit app

  • Unfortunately UIHostingController allows you to integrate SwiftUI views only in existing UIWindow. You won’t get immersive Full Space this way.

Add a Comment

I’ve stuck with the same problem.

As an update to this, you cannot present an ImmersiveSpace from a UIKit app, you can only host some SwiftUI views as I mentioned above (that the video shows).