The UIViewControllerContextTransitioning protocol’s methods provide contextual information for transition animations between view controllers. Do not adopt this protocol in your own classes, nor should you directly create objects that adopt this protocol. During a transition, the animator objects involved in that transition receive a fully configured context object from UIKit. Custom animator objects—objects that adopt the UIViewControllerAnimatedTransitioning or UIViewControllerInteractiveTransitioning protocol—should simply retrieve the information they need from the provided object.


A context object encapsulates information about the views and view controllers involved in the transition. It also contains details about the how to execute the transition. For interactive transitions, the interactive animator object uses the methods of this protocol to report the animation’s progress. When the animation starts, the interactive animator object must save a pointer to the context object. Based on user interactions, the animator object then calls the updateInteractiveTransition(_:), finishInteractiveTransition(), or cancelInteractiveTransition() methods to report the progress toward completing the animation. Those methods send that information to UIKit so that it can drive the timing of the animations.


Accessing the Transition Objects

var containerView: UIView

The view that acts as the superview for the views involved in the transition.

func viewController(forKey: UITransitionContextViewControllerKey)

Returns a view controller involved in the transition.

func view(forKey: UITransitionContextViewKey)

Returns the specified view involved in the transition.

Getting the Transition Frame Rectangles

func initialFrame(for: UIViewController)

Returns the starting frame rectangle for the specified view controller’s view.

func finalFrame(for: UIViewController)

Returns the ending frame rectangle for the specified view controller’s view.

Getting the Transition Behaviors

var presentationStyle: UIModalPresentationStyle

Returns the presentation style for the view controller transition.

Reporting the Transition Progress

func completeTransition(Bool)

Notifies the system that the transition animation is done.

func updateInteractiveTransition(CGFloat)

Updates the completion percentage of the transition.

func finishInteractiveTransition()

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

func cancelInteractiveTransition()

Notifies the system that user interactions canceled the transition.

var transitionWasCancelled: Bool

Returns a Boolean value indicating whether the transition was canceled.

Getting the Rotation Factor

var targetTransform: CGAffineTransform

Returns a transform indicating the amount of rotation being applied during the transition.


View Controller Transition Keys

The keys you use to identify the view controllers involved in a transition.

View Transition Keys

The keys you use to identify the views involved in a transition.

Instance Properties

Instance Methods


Inherits From