From my question here, I would like to use the scene with notifications in Reality Composer like
Scene1.notifications.replay.post()
Therefore, I load the scene in ContentView and binding to the ARViewContainer for appending the scene, but it didn't work.
How can I do it?
Here's my code:
struct: ContentView: View {
@State private var arView = ARView(frame: .zero)
@State private var Scene1 = Experience.loadSceneAsync(completion: { result in
do {
let Scene = try result.get()
} catch {
print("Error")
}
})
var body: some View {
ZStack {
ARViewContainer(arView: $arView, Scene1: $Scene1)
.ignoresSafeArea()
Button("play") {
Scene1.notifications.replay.post()
}
}
}
}
struct ARViewContainer: UIViewRepresentable {
@Binding var arView: ARView
@Binding var Scene1: Experience1.Scene1
func makeUIView(context: Context) -> ARView {
arView.scene.anchors.append(Scene1)
return ARView
}
}