TLDR: Looking for a solution to enable interactive dismissal when dragging down from the navigation bar, but not from the view controller's view.
Introduction
iOS 13 modal view controllers allow for disabling the interactive dismissal in a few ways:
- Setting
vc.modalPresentationStyle = .fullScreen
(see Presenting modal in iOS 13 fullscreen) - Setting
viewController.isModalInPresentation = true
(see Disable the interactive dismissal of presented view controller in iOS 13) - Implementing
UIAdaptivePresentationControllerDelegate
delegate methods (see UINavigationBar changes in iOS13)
The first one is great if you want same behavior as iOS 12 and below.
The second one, is great to prevent interactive dismissal, but still allows for dragging the view controller down when pulling from the main view controller view (with a nice animation).
The later allows for better handling of events, but doesn't help preventing dragging from the view controller's view.
Pull-to-refresh (close)
The closest thing I've seen is setting the refresh control to prevent dismissal during pull-to-refresh. This GIF shows the behavior I'm looking for (source):
This pull-to-refresh interaction can be seen in the modal Inbox screen on the iOS Calendar app.
What I'm looking for
The behavior I'm looking for is the same as pull-to-refresh above, but without the scroll view and refresh control.
Basically, touches on the view controller's view should not trigger the interactive dismissal.
I've tried the following, with no luck:
view.isExclusiveTouch = true
view.isUserInteractionEnabled = false
In summary, what I need:
- Interactive dismissal enabled when dragging from the navigation bar
- Interactive dismissal disabled when dragging anywhere inside the main view
- No bounce for dismissal
Thank you!