Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created January 10, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/471980a3dfb9a9aa4be93385ee26854a to your computer and use it in GitHub Desktop.
Save anupamchugh/471980a3dfb9a9aa4be93385ee26854a to your computer and use it in GitHub Desktop.
struct ARViewContainer: UIViewRepresentable {
@Binding var overlayText: String
func makeCoordinator() -> ARViewCoordinator{
ARViewCoordinator(self, overlayText : $overlayText)
}
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
arView.addCoaching()
let config = ARWorldTrackingConfiguration()
config.planeDetection = .horizontal
arView.session.run(config, options: [])
arView.setupGestures()
arView.session.delegate = context.coordinator
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {
}
}
class ARViewCoordinator: NSObject, ARSessionDelegate {
var arVC: ARViewContainer
@Binding var overlayText: String
init(_ control: ARViewContainer, overlayText: Binding<String>) {
self.arVC = control
_overlayText = overlayText
}
func session(_ session: ARSession, didUpdate frame: ARFrame) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment