NavigationAnimationDelegate

open class NavigationAnimationDelegate : NSObject

NavigationAnimationDelegate is used as the delegate of a NavigationCoordinator’s rootViewController to allow for push-transitions to specify animations.

NavigationAnimationDelegate conforms to the UINavigationControllerDelegate protocol and is intended for use as the delegate of one navigation controller only.

Note

Do not override the delegate of a NavigationCoordinator’s rootViewController. Instead use the delegate property of the NavigationCoordinator itself.
  • The velocity threshold needed for the interactive pop transition to succeed

    Declaration

    Swift

    open var velocityThreshold: CGFloat { get }
  • The transition progress threshold for the interactive pop transition to succeed

    Declaration

    Swift

    open var transitionProgressThreshold: CGFloat { get }
  • Declaration

    Swift

    open func navigationController(_ navigationController: UINavigationController,
                                   interactionControllerFor animationController: UIViewControllerAnimatedTransitioning
        ) -> UIViewControllerInteractiveTransitioning?

    Parameters

    navigationController

    The delegate owner.

    animationController

    The animationController to return the interactionController for.

    Return Value

    If the animationController is a TransitionAnimation, it returns its interactionController. Otherwise it requests an interactionController from the NavigationCoordinator’s delegate.

  • Declaration

    Swift

    open func navigationController(_ navigationController: UINavigationController,
                                   animationControllerFor operation: UINavigationController.Operation,
                                   from fromVC: UIViewController,
                                   to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning?

    Parameters

    navigationController

    The delegate owner.

    operation

    The operation being executed. Possible values are push, pop or none.

    fromVC

    The source view controller of the transition.

    toVC

    The destination view controller of the transition.

    Return Value

    The destination view controller’s animationController depending on its transitioningDelegate. In the case of a push operation, it returns the toVC’s presentation animation. For pop it is the fromVC’s dismissal animation. If there is no transitioningDelegate or the operation none is used, it uses the NavigationCoordinator’s delegate as fallback.

  • Declaration

    Swift

    open func navigationController(_ navigationController: UINavigationController,
                                   didShow viewController: UIViewController, animated: Bool)

    Parameters

    navigationController

    The delegate owner.

    operation

    The operation being executed. Possible values are push, pop or none.

    viewController

    The target view controller.

  • Declaration

    Swift

    open func navigationController(_ navigationController: UINavigationController,
                                   willShow viewController: UIViewController,
                                   animated: Bool)

    Parameters

    navigationController

    The delegate owner.

    operation

    The operation being executed. Possible values are push, pop or none.

    viewController

    The view controller to be shown.

  • See UIGestureRecognizerDelegate documentation for further reference.

    Note

    This method alters the target of the gestureRecognizer to either its former delegate (UIKit default) or this class depending on whether a pop animation has been specified.

    Declaration

    Swift

    open func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool

    Parameters

    gestureRecognizer

    The gesture recognizer this class is the delegate of. This class is used as the delegate for the interactivePopGestureRecognizer of the navigationController.

    Return Value

    This method returns true, if and only if

    • there are more than 1 view controllers on the navigation controller stack (so that it is possible to pop a viewController) and
    • it is the interactivePopGestureRecognizer to call this method
  • This method handles changes of the navigation controller’s interactivePopGestureRecognizer.

    This method performs the top-most dismissalAnimation and informs its interaction controller about changes of the interactivePopGestureRecognizer’s state.

    Declaration

    Swift

    @objc
    open func handleInteractivePopGestureRecognizer(_ gestureRecognizer: UIGestureRecognizer)

    Parameters

    gestureRecognizer

    The interactivePopGestureRecognizer of the UINavigationController.

  • This method sets up the interactivePopGestureRecognizer of the navigation controller to allow for custom interactive pop animations.

    This method overrides the delegate of the interactivePopGestureRecognizer to self, but keeps a reference to the original delegate to enable the default pop animations.

    Declaration

    Swift

    open func setupPopGestureRecognizer(for navigationController: UINavigationController)

    Parameters

    navigationController

    The navigation controller to be set up.