I want to use ARKit with NavigationView.
I couldn't do it.
No error will occur, but the app will stop.
Procedure:
1.Launch app
2.Show AR View
3.Return to the first screen
4.Open AR View again
5.App stops
Please tell me how to fix it or an alternative.
Xcode: 11.2.1 (11B500)
iOS: iPadOS13.3 beta3 (Japanese)
Device: iPad Pro (11-inch, 2018)
I tried two types of code.
(oneView is an AR view)
Code:
import SwiftUI
import RealityKit
struct ContentView: View {
var body: some View {
NavigationView {
List {
VStack {
NavigationLink(destination: oneView()) {
Text("Watch")
}
}.navigationBarTitle("AR")
}
}.navigationViewStyle(StackNavigationViewStyle())
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
Code:
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
List {
NavigationLink(destination: oneView()) {
Text("Show Next")
}
}
}
}
}