Skip to content

Instantly share code, notes, and snippets.

@artur-ios-dev
Created August 1, 2018 11:56
Show Gist options
  • Save artur-ios-dev/6b8c53cbc39c046bfcc8ff9d148aa6d6 to your computer and use it in GitHub Desktop.
Save artur-ios-dev/6b8c53cbc39c046bfcc8ff9d148aa6d6 to your computer and use it in GitHub Desktop.
final class TransitionCoordinator: NSObject, UINavigationControllerDelegate {
// 1
var interactionController: UIPercentDrivenInteractiveTransition?
// 2
func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
switch operation {
case .push:
return TransitionAnimator(presenting: true)
case .pop:
return TransitionAnimator(presenting: false)
default:
return nil
}
}
// 3
func navigationController(_ navigationController: UINavigationController, interactionControllerFor animationController: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
return interactionController
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment