Skip to content

Instantly share code, notes, and snippets.

@yojkim
Created June 12, 2019 06:26
Show Gist options
  • Save yojkim/adfe9ca363fba86b7e1b53677e5007ba to your computer and use it in GitHub Desktop.
Save yojkim/adfe9ca363fba86b7e1b53677e5007ba to your computer and use it in GitHub Desktop.
extension UINavigationController: UINavigationControllerDelegate {
open override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
}
public func navigationController(
_ navigationController: UINavigationController,
didShow viewController: UIViewController,
animated: Bool)
{
if self.viewControllers.count > 1 {
self.interactivePopGestureRecognizer?.isEnabled = true
} else {
self.interactivePopGestureRecognizer?.isEnabled = false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment