swiftui – Swipe again gesture not working in iOS 17 when NavBar is hidden – Swift UI

Spread the love

I’ve been utilizing the next extension in Swift UI to allow swipe again gestures even when the navigation bar is hidden. Nonetheless, after updating to iOS 17 (beta), it appears that evidently this code is not working. I am undecided if this can be a bug within the new iOS model or if there is a completely different method to attain this performance. Can anybody assist me troubleshoot this concern or counsel an alternate resolution?

extension UINavigationController: UIGestureRecognizerDelegate {
   open override func viewDidLoad() {
    interactivePopGestureRecognizer?.delegate = self

  // Permits swipe again gesture after hiding commonplace navigation bar with .navigationBarHidden(true).
  public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
    viewControllers.rely > 1

  // Permits interactivePopGestureRecognizer to work concurrently with different gestures.
  public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    viewControllers.rely > 1

  // Blocks different gestures when interactivePopGestureRecognizer begins (my TabView scrolled along with display screen swiping again)
  public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    viewControllers.rely > 1


Steps to Reproduce:

Create a SwiftUI challenge.
Use the offered extension to allow swipe again gestures.
Set .navigationBarHidden(true) on a view.
Attempt to swipe again on the view.
Anticipated Habits:
The view ought to reply to the swipe again gesture, even with the navigation bar hidden.

Precise Habits:
The swipe again gesture does not work, and the view stays unchanged.

Further Info:

I’ve examined this code on iOS 16, and it really works as anticipated.
I’ve verified that the difficulty happens particularly on iOS 17 beta.
My Xcode model is [15A5219j].
I have never made some other important modifications to my code.
Any help in resolving this concern or solutions for different approaches could be tremendously appreciated. Thanks!

By offering this data, it’s best to obtain related help from the Stack Overflow group, whether or not it is a resolution to the issue or steerage on any modifications wanted for compatibility with iOS 17.

Leave a Reply

Your email address will not be published. Required fields are marked *