Fix Broken Swipe to Go Back With Hidden Navigation Bar

Dev

Occasionally you need to a show a view controller as part of a UINavigationController stack where you want the navigation bar hidden. Unfortunately, hiding the navigation bar breaks the swipe right to go back feature.

You can fix it by doing this in your viewDidLoad method:

navigationController?.setNavigationBarHidden(true, animated: true)
navigationController?.interactivePopGestureRecognizer.delegate = self

The Author

iOS and Mac developer.