SwiftUI: How to use NavigationStack inside the .toolbar
First, why do I mostly find a solution after posting a Stackoverflow question?
So most examples and tutorials only use NavigationStack
and NavigationLink
inside a List
. I’m surprised by how nobody seems to implement using the .toolbar
modifier.
The solution was a little straightforward I found out.
Instead of NavigationView
, you use the new and shiny NavigationStack
. And use .navigationDestination()
instead of NavigationLink
.
|
|
I need to get more familiar with SwiftUI’s modifiers as it is still a little confusing for me.