InterruptibleTransitionAnimation
@available(iOS 10.0, *)
open class InterruptibleTransitionAnimation : InteractiveTransitionAnimation
Use InterruptibleTransitionAnimation to define interactive transitions based on the UIViewPropertyAnimator APIs introduced in iOS 10.
-
Creates an interruptible transition animation based on duration, an animator generator closure and an interaction controller generator closure.
Declaration
Swift
public init(duration: TimeInterval, generateAnimator: @escaping (UIViewControllerContextTransitioning) -> UIViewImplicitlyAnimating, generateInteractionController: @escaping () -> PercentDrivenInteractionController?)Parameters
durationThe total duration of the animation.
generateAnimatorA generator closure to create a
UIViewPropertyAnimatordynamically.generateInteractionControllerA generator closure to create an interaction controller which handles animation progress changes.
-
Creates an interruptible transition animation based on duration and an animator generator closure.
A
UIPercentDrivenInteractiveTransitionis used as interaction controller.Declaration
Swift
public convenience init(duration: TimeInterval, generateAnimator: @escaping (UIViewControllerContextTransitioning) -> UIViewImplicitlyAnimating)Parameters
durationThe total duration of the animation.
generateAnimatorA generator closure to create a
UIViewPropertyAnimatordynamically.
-
Generates an interruptible animator based on the transitionContext. It further adds a completion block to the animator to ensure it is deallocated once the transition is finished.
This code is called once per transition to generate the interruptible animator which is reused in subsequent calls of
interruptibeAnimator(using:).Declaration
Swift
open func generateInterruptibleAnimator(using transitionContext: UIViewControllerContextTransitioning) -> UIViewImplicitlyAnimatingParameters
transitionContextThe context in which the transition is performed.
-
See UIViewControllerAnimatedTransitioning for further information.
This method simply calls
startAnimation()on the interruptible animator.Declaration
Swift
open override func animateTransition(using transitionContext: UIViewControllerContextTransitioning)Parameters
transitionContextThe context in which the transition is performed.
-
See UIViewControllerAnimatedTransitioning for further information.
This method returns an already generated interruptible animator, if present. Otherwise it generates a new one using
generateInterruptibleAnimator(using:).Declaration
Swift
open func interruptibleAnimator(using transitionContext: UIViewControllerContextTransitioning ) -> UIViewImplicitlyAnimatingParameters
transitionContextThe context in which the transition is performed.
View on GitHub
InterruptibleTransitionAnimation Class Reference