InteractiveTransitionAnimation
open class InteractiveTransitionAnimation : NSObject, TransitionAnimation
InteractiveTransitionAnimation
provides a simple interface to create interactive transition animations.
An InteractiveTransitionAnimation
can be created by providing the duration, the animation code
and (optionally) a closure to create an interaction controller.
Note
To get further information read the UIKit documentation of UIViewControllerAnimatedTransitioning, UIViewControllerInteractiveTransitioning, UIViewControllerContextTransitioning and UIPercentDrivenInteractiveTransition.-
Declaration
Swift
open var interactionController: PercentDrivenInteractionController? { get }
-
Creates an InteractiveTransitionAnimation with a duration, an animation closure and a closure to generate an interaction controller.
Declaration
Swift
public init(duration: TimeInterval, transition: @escaping (UIViewControllerContextTransitioning) -> Void, generateInteractionController: @escaping () -> PercentDrivenInteractionController?)
-
Convenience initializer for
init(duration:transition:generateInteractionController:)
. By ommitting thegenerateInteractionController
closure, the transition will use UIPercentDrivenInteractiveTransition to create interaction controllers.Declaration
Swift
public convenience init(duration: TimeInterval, transition: @escaping (UIViewControllerContextTransitioning) -> Void)
Parameters
duration
The duration of the animation.
transition
The animation code.
-
Convenience initializer for
init(duration:transition:generateInteractionController:)
. Provides a simple interface to convert StaticTransitionAnimations to interactive transition animations.Declaration
Swift
public convenience init(transitionAnimation: StaticTransitionAnimation, generateInteractionController: @escaping () -> PercentDrivenInteractionController?)
Parameters
transitionAnimation
The StaticTransitionAnimation to be converted.
generateInteractionController
The closure to generate an interaction controller when needed, usually at the beginning of a transition.
-
Convenience initializer for
init(duration:transition:)
. Provides a simple interface to convert StaticTransitionAnimations to interactive transition animations.Declaration
Swift
public convenience init(transitionAnimation: StaticTransitionAnimation)
Parameters
transitionAnimation
The StaticTransitionAnimation to be converted.
-
See UIViewControllerAnimatedTransitioning for further information.
Declaration
Swift
open func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval
Parameters
transitionContext
The context of the transition.
Return Value
The transition duration as specified in the initializer.
-
See UIViewControllerAnimatedTransitioning for further information.
Declaration
Swift
open func animateTransition(using transitionContext: UIViewControllerContextTransitioning)
Parameters
transitionContext
The context of a transition for which the animation should be started.
-
This method is used to generate an applicable interaction controller.
Note
To allow for more complex logic to create a specific interaction controller, override this method in your subclass.Declaration
Swift
open func generateInteractionController() -> PercentDrivenInteractionController?
-
Starts the transition animation by generating an interaction controller.
Declaration
Swift
open func start()
-
Ends the transition animation by deleting the interaction controller.
Declaration
Swift
open func cleanup()