HomeiOS Developmentswift - iOS 26 - Swipe to dismiss in a navigation controller...

swift – iOS 26 – Swipe to dismiss in a navigation controller by beginning the swipe on the left fringe of the display and never middle of display


iOS 26 provides a brand new gesture to deal with this case. UINavigationController interactiveContentPopGestureRecognizer will be disabled to forestall swiping from the content material space of the display. This then solely permits swiping from the left fringe of the display.

If you wish to stop content material space swiping for all view controllers within the navigation stack, add the next line to the viewDidAppear of the basis view controller:

navigationController?.interactiveContentPopGestureRecognizer?.isEnabled = false

In the event you solely wish to stop it for a particular view controller within the stack, then disable it within the viewDidAppear of that one view controller and re-enable it in its viewDidDisappear.

Don’t use the viewWillAppear or viewWillDisappear strategies since these are referred to as initially of the interactive swiping even when you find yourself canceling the dismissal.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments