ARKit-CoreLocation
ARKit-CoreLocation copied to clipboard
Add SwiftUI Support
With the latest release of Xcode 11 Beta, there is "SwiftUI". Ensure that we can support this.
Any chance of SwiftUI support?
You can wrap your ARCL ViewController in a UIViewControllerRepresentable
. Here is an example:
import SwiftUI
import CoreLocation
import ARCL
struct ARCLView: View {
var sceneLocationView = SceneLocationView()
var body: some View {
return ARCLViewContainer().edgesIgnoringSafeArea(.all)
}
}
struct ARCLViewContainer: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> ARCLViewController {
return ARCLViewController()
}
func updateUIViewController(_ uiView: ARCLViewController, context: Context) {}
}
struct ARCLView_Previews: PreviewProvider {
static var previews: some View {
ARCLView()
}
}
The ARCLViewController
is simply like the examples:
class ARCLViewController: UIViewController {
...
}
Also using this in SwiftUI np. I have a view with a UIViewControllerRepresentable
which creates a Coordinator that extends ARSessionDelegate
, as well as a UIViewController. The controller allows me to read AR data in real time from the session and update my Environment object, which in turns passes values to the UIViewController from the Representable as my Environment object changes.
Hello guys, I successfully integrated the ARCL ViewController with UIViewControllerRepresentable. Did you find a way to listen to LNTouchDelegate events?