SwiftUI modals in Xcode Beta 6?

Using wrappedValue instead of value seems to work in Xcode Beta 6:

self.presentationMode.wrappedValue.dismiss()

You can dimiss .sheet, .popover, .actionSheet by passing in the binding that controls it's showing, here $modalIsPresented and set it to false inside to programmatically dismiss it.


Try to check this:

.presentation(showModal ? Modal(Text("Modal screen"), onDismiss: {
self.showModal.toggle()
}) : nil)

The default modal presentation doesn't prove any visual way for the user to close the modal, but as of iOS 13 the user can swipe down the view to make it disappear.

In detail: https://alejandromp.com/blog/2019/06/24/improving-swiftui-modal-presentation-api/