Missing API to disable dismissing modal sheet with interactive gesture

Number:rdar://FB7829126 Date Originated:06/30/2020
Status:Open Resolved:
Product:iOS & iPad OS Product Version:
Classification:Incorrect/Unexpected Behavior Reproducible:
In UIKit, developers can use the `isModalInPresentation` property on `UIViewController` to enforce a modal behavior and prevent users from dismissing the modal using the swipe down gesture. This is especially useful when the sheet cannot be dismissed in order to prevent data loss.

However, in SwiftUI there is no such documented equivalent for sheets. This feedback suggests adding either a modifier or a parameter on `sheet` to replicate the behavior of `isModalInPresentation`, for example:

`view.sheet(isPresented: $isPresented, isModal: true) { ... }` or `view.sheet(isPresented: $isPresented) { Text("Modal").presentationType(.modal) }`

This would avoid using workarounds such as swizzling UIViewController or trying to manipulate the behavior of sheets using a UIViewControllerRepresentable.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!