Here is my code:
swift
struct ARDisplayView: View {
var body: some View {
return ARViewContainer().edgesIgnoringSafeArea(.all)
}
}
struct ARViewContainer: UIViewRepresentable {
var arView = ARView(frame: .zero)
func makeCoordinator() - Coordinator {
Coordinator(parent: self)
}
class Coordinator: NSObject, ARSessionDelegate {
var parent: ARViewContainer
var videoPlayer: AVPlayer!
init(parent: ARViewContainer) {
self.parent = parent
}
blahblah...
and This is ContentView.swift
swift
import SwiftUI
import RealityKit
struct ContentView: View {
var body: some View {
ARDisplayView()
}
}
I want to make a button to return ARViewContainer.
I tried this but it doesn't work:
swift
Button(action: { return ARViewContainer().edgesIgnoringSafeArea(.all) }) {
Text("Start AR")
}
What should I do?
Selecting any option will automatically load the page