Hello,
Thanks for making this example, I found it very helpful! I was getting the following error in Xcode 15.4 when sheets or fullScreenCovers were displayed on a page:
Presenting view controller <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x103019800> from detached view controller <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x10481a400> is not supported, and may result in incorrect safe area insets and a corrupt root presentation. Make sure <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x10481a400> is in the view controller hierarchy before presenting from it. Will become a hard exception in a future release.
The root cause is applying the .sheet() and .fullScreenCover() modifiers to the page rather than the NavigationStack:
NavigationStack(path: $coordinator.path) {
coordinator.build(page: .main)
.navigationDestination(for: AppPages.self) { page in
coordinator.build(page: page)
}
} <---- applied to navigation stack
.sheet(item: $coordinator.sheet) { sheet in
coordinator.buildSheet(sheet: sheet)
}
.fullScreenCover(item: $coordinator.fullScreenCover) { item in
coordinator.buildCover(cover: item)
}
Hello,
Thanks for making this example, I found it very helpful! I was getting the following error in Xcode 15.4 when sheets or fullScreenCovers were displayed on a page:
Presenting view controller <_TtGC7SwiftUI29PresentationHostingControllerVS_7AnyView_: 0x103019800> from detached view controller <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x10481a400> is not supported, and may result in incorrect safe area insets and a corrupt root presentation. Make sure <_TtGC7SwiftUI32NavigationStackHostingControllerVS_7AnyView_: 0x10481a400> is in the view controller hierarchy before presenting from it. Will become a hard exception in a future release.The root cause is applying the .sheet() and .fullScreenCover() modifiers to the page rather than the NavigationStack: