I chose to use the standard code created by selecting "Augmented Reality App" in Xcode and using it.
But I get the error Use of unresolved identifier 'Experience'
How can I solve this?
ARView.swift
import SwiftUI
import RealityKit
struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
// Load the "Box" scene from the "Experience" Reality File
let boxAnchor = try! Experience.loadBox()
// Add the box anchor to the scene
arView.scene.anchors.append(boxAnchor)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}
ARKitView.swift
import SwiftUI
struct ARKitView: View {
var body: some View {
return ARViewContainer().edgesIgnoringSafeArea(.all)
}
}
struct ARKitView_Previews: PreviewProvider {
static var previews: some View {
ARKitView()
}
}
Experience.rcproject
「Box」Seen