If anyone still needs help with this I can make a new post and explain my solution. Very confusing initially until you understand the almost non-existent documentation that was graciously provided to us.
Post
Replies
Boosts
Views
Activity
I just figured this out today! For those that are potentially having a similar problem,
Have a class similar to -
@MainActor
class MyClass: ObservableObject, @unchecked Sendable { ... }
Make sure this class has all instances of DataProviders you need and also has an instance of ARKitSession.
Then, in your main file or wherever you declare your App's SwiftUI.Scene, have something similar to this outside of the App block:
@MainActor
enum MyClassContainer {
private(set) static var myClass = MyClass()
}
and inside of your SwiftUI.Scene block -
ImmersiveSpace(id: "myId") {
MyImmersionView(myClass: MyClassContainer.myClass)
}
.immersionStyle(selection: $immersiveController.currentStyle, in: .mixed)
then, make sure you actually run the ARKitSession inside of your immersive space inside of a .task{} method chain off the end of the RealityView block!
Hope this helps :)