Skip to content

Instantly share code, notes, and snippets.

@aduuub
Created April 3, 2020 02:37
Show Gist options
  • Save aduuub/4fd5acd6779523558dcab60901f92503 to your computer and use it in GitHub Desktop.
Save aduuub/4fd5acd6779523558dcab60901f92503 to your computer and use it in GitHub Desktop.
internal class BaseNavigationController: UINavigationController {
/// Indicates if a UIViewController is currently being pushed onto this navigation controller
private var duringPushAnimation = false
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self // to track when a view controller is being pushed
self.interactivePopGestureRecognizer?.delegate = self // for swipe the pop gesture recogniser
}
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
duringPushAnimation = true
super.pushViewController(viewController, animated: animated)
}
deinit {
delegate = nil
interactivePopGestureRecognizer?.delegate = nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment