Animation

open class Animation : NSObject

Animation is used to set presentation and dismissal animations for presentables.

Depending on the transition in use, different properties of a UIViewController are set to make sure the transition animation is used.

Note

To not override the previously set Animation, use nil when initializing a transition.

Make sure to hold a strong reference to the Animation object, as it is only held by a weak reference.

  • Use Animation.default to override currently set animations and reset to the default animations provided by iOS

    Note

    To disable animations make sure to use non-animating TransitionOptions when triggering.

    Declaration

    Swift

    public static let `default`: Animation
  • Creates an Animation object containing a presentation and a dismissal animation.

    Declaration

    Swift

    public init(presentation: TransitionAnimation?, dismissal: TransitionAnimation?)

    Parameters

    presentation

    The transition animation performed when transitioning to a presentable.

    dismissal

    The transition animation performed when transitioning away from a presentable.

  • See UIViewControllerTransitioningDelegate for further reference.

    Declaration

    Swift

    open func animationController(forPresented presented: UIViewController,
                                  presenting: UIViewController,
                                  source: UIViewController) -> UIViewControllerAnimatedTransitioning?

    Parameters

    presented

    The view controller to be presented.

    presenting

    The view controller that is presenting.

    source

    The view controller whose present(_:animated:completion:) was called.

    Return Value

    The presentation animation when initializing the Animation object.

  • See UIViewControllerTransitioningDelegate for further reference.

    Declaration

    Swift

    open func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning?

    Parameters

    dismissed

    The view controller to be dismissed.

    Return Value

    The dismissal animation when initializing the Animation object.

  • See UIViewControllerTransitioningDelegate for further reference.

    Declaration

    Swift

    open func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning)
        -> UIViewControllerInteractiveTransitioning?

    Parameters

    animator

    The animator of this transition, which is most likely the presentation animation.

    Return Value

    The presentation animation’s interaction controller.

  • See UIViewControllerTransitioningDelegate for further reference.

    Declaration

    Swift

    open func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning)
        -> UIViewControllerInteractiveTransitioning?

    Parameters

    animator

    The animator of this transition, which is most likely the dismissal animation.

    Return Value

    The dismissal animation’s interaction controller.