Created
January 19, 2020 18:55
-
-
Save anupamchugh/5f6df4d97896744b06539d5f543cde9a 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
import SwiftUI | |
struct ContentView : View { | |
var body: some View { | |
return ARViewContainer().edgesIgnoringSafeArea(.all) | |
} | |
} | |
struct ARViewContainer: UIViewRepresentable { | |
func makeUIView(context: Context) -> ARView { | |
let arView = ARView(frame: .zero) | |
let config = ARWorldTrackingConfiguration() | |
config.planeDetection = .horizontal | |
arView.session.run(config, options: []) | |
let box1 = CustomEntity( | |
color: .yellow, | |
position: [0.5,-1.5,-3] | |
) | |
arView.scene.anchors.append(box1) | |
let box2 = CustomEntity( | |
color: .green, | |
position: [-0.5,-1.5, -3] | |
) | |
arView.scene.anchors.append(box2) | |
box1.addCollisions() | |
arView.installGestures(.all, for: box1) | |
return arView | |
} | |
func updateUIView(_ uiView: ARView, context: Context) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment