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