Created
January 10, 2020 13:27
-
-
Save anupamchugh/471980a3dfb9a9aa4be93385ee26854a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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