There is also DynamicDestinationLink , in case you don’t know what data will be passed to your detail view until later in your view master view. With this, you can dynamically set up your DetailView and change the bound data at will. I didn’t really have the opportunity to use it within my app, but here is a very nice tutorial about it.

And one more thing, here is another tutorial. If you want to programmatically push a view, you can use NavigationDestinationLink — useful if you want to do a router for example.

Presentation

Presentation is for everything presented modally, and it can be a view hierarchy (which you can compare to a UIKit presentViewController ) but also for Alert , ActionSheet , etc…

Unlike navigation, as SwiftUI is declarative, you’ll have to manage the presentation state of your presented views. It’s very seamless; you create a @State var isSomethingPresented : Bool property, and in the .sheet(), .actionSheet(), etc.. function, you can pass it as a binding. So you can control if your sheet (you can compare it to a full view controller presented as a modal) or you actionSheet should be presented.

Then you just have to toggle it wherever it pleases you, as the user touches the button that is supposed to present the modal/sheet or the ActionSheet, for example.

In the code above, you can see two examples of presentation. One is an action sheet, with a binding to its presentation, the other is a presentation of a full screen sheet/modal view. Then if you look at the onAddButton() function, it toggles a boolean, and my action sheet will effectively be presented. You would need to do exactly the same to present the modal. That’s all you need.

Don’t forget to toggle the boolean in the buttons of the ActionSheet to dismiss it.

Within the view that is presented as part of any of a presentation call, you can access an Environment variable to access its isPresented state.

It’s exposed by SwiftUI — you can also toggle — useful to dismiss your modal within itself without forwarding any callback.

About Environment , I invite you to follow this Apple tutorial about working with controls. It’ll shine some light about editing the state Environment variable which is very powerful.