Good afternoon, everyone! I ran into this problem - when I try to exit the page in a separate window, the page freezes. Here is the code for the minimal implementation.
import SwiftUI
struct ContentView: View {
@State private var showPageNav: Bool = false
var body: some View {
NavigationView {
VStack {
Text("Show Page Start")
Button("Show Page Navigation") {
self.showPageNav = true
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
.overlay(
NavigationLink(
destination: PageView(handleExit: { self.showPageNav = false }),
isActive: self.$showPageNav,
label: { EmptyView() }
)
)
}
.navigationViewStyle(.stack)
}
}
struct PageView: View {
let handleExit: () -> Void
@State private var showPageFull: Bool = false
var body: some View {
VStack {
Text("Show Page Navigation")
Button("Show Page FullScreenCover") {
self.showPageFull = true
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
.fullScreenCover(isPresented: self.$showPageFull) {
Text("Show Page FullScreenCover")
Button("Exit Page Navigation") {
self.handleExit()
}
}
}
}
I tested on iOS 15 and iOS 16.