Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import SwiftUI
import RealityKit
struct AnyViewRepresentable<T: UIView>: UIViewRepresentable {
let view: T
func makeUIView(context: Context) -> T { return view }
func updateUIView(_ uiView: T, context: Context) {}
}
struct ContentView : View {
let arView = ARView(frame: UIScreen.main.bounds)
let models: [ModelEntity]
init() {
let boxAnchor = try! Experience.loadBox()
var models = [ModelEntity]()
boxAnchor.getModelEntitiesInDescendants(models: &models)
arView.scene.anchors.append(boxAnchor)
self.models = models
}
var body: some View {
ZStack {
AnyViewRepresentable(view: arView)
ARSettingsView(models: models)
}
.edgesIgnoringSafeArea(.all)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment