SwiftUI and ARKit

can we use the new SwiftUI with ARKit and RealityKit and composer?


thanks,

Dale

Replies

Now that is a question!


I am looking at that right now and yes the latest relerase does support SwiftUI withj realityKit, but it is not clear how you get at things like ARWorldConfiguration settings etc in SwiftUI. If you are happy to accept many of the default settings this might work for you... Me - I have need of things to fiddle with for my applications... If you get a good solution please let me know..

You can configure the ARView through the use of a UIViewRepresentable container. If you create a new AR project in Xcode 11 and specify that you would like to use both RealityKit and SwiftUI most of the infrastructure needed is created for you. I recommend that you take a look at the "Interfacing with UIKit" SwiftUI tutorial, which shows you how you can interact with UIViews in SwiftUI: https://developer.apple.com/tutorials/swiftui/interfacing-with-uikit