Since SwiftUI is declarative there is no dismiss methode.
How can is add a dismiss/close button to the DetailView?
Navigation or dismiss if ModalJust take the presentationMode from the environment in the destination view and dismiss the wrappedValue from it:
struct DestinationView: View {
@Environment(\.presentationMode) private var presentationMode
var body: some View {
Button("Dismiss") {
self.presentationMode.wrappedValue.dismiss()
}
}
}