A percent-driven interactive transition object drives the custom animation between the disappearance of one view controller and the appearance of another. It relies on a transition animator delegate—a custom object that adopts the UIViewControllerAnimatedTransitioning protocol—to set up and perform the animations.


To use this concrete class, return an instance of it from your view controller delegate when asked for an interactive transition controller. As user events arrive that would affect the progress of a transition, call the update(_:), cancel(), and finish() methods to reflect the current progress. For example, you might call these methods from a gesture recognizer to reflect how much of the gesture is completed.

You can subclass UIPercentDrivenInteractiveTransition, but if you do so you must start each of your method overrides with a call to the super implementation of the method.


Accessing Transition Attributes

var completionCurve: UIViewAnimationCurve

Indicates the animation completion curve for an interactive transition.

var duration: CGFloat

The overall duration (in seconds) of the transition animation.

var percentComplete: CGFloat

The amount of the transition (specified as a percentage of the overall duration) that is complete.

var completionSpeed: CGFloat

The speed of the transition animation.

Managing a Transition

func update(CGFloat)

Updates the completion percentage of the transition.

func cancel()

Notifies the system that user interactions canceled the transition.

func finish()

Notifies the system that user interactions signaled the completion of the transition.

Instance Methods