Hi everyone,
I’m experimenting with SwiftUI's new NavigationStack / navigationDestination API. Normally, when you navigate to a value using NavigationLink(value:) and a matching navigationDestination(for:), the destination view is pushed onto the navigation stack.
What I’d like to know is: Is there a way to present that destination view as a sheet instead of pushing it? Essentially: Can a NavigationDestination be shown modally?
Here’s a simplified example of what I mean:
struct RootView: View {
var body: some View {
NavigationStack {
NavigationLink(value: "Example") {
Text("Push me!")
}
.navigationDestination(for: String.self) { _ in
DetailView() // <--- Can this be shown as a sheet?
}
}
}
}
My questions are:
Is there a built‑in way to make a navigationDestination present modally (as .sheet) instead of pushing?
If not, is the recommended approach to handle .sheet state manually outside of the NavigationStack and bypass navigationDestination for such cases?
Can the NavigationPath itself somehow encode a modal presentation style for certain types?
Thanks in advance for any tips or confirmation that this is (not) possible in SwiftUI.