Instance Method

notifyWhenInteractionChanges(_:)

Registers a block to be executed when a transition changes from interactive to non-interactive.

Required.

Declaration

func notifyWhenInteractionChanges(_ handler: @escaping (UIViewControllerTransitionCoordinatorContext) -> Void)

Parameters

handler

The block to execute when the transition changes from interactive to noninteractive. The block has no return value and takes the following parameter:

Discussion

Your handler block is executed any time the transition changes from interactive to noninteractive, including when the transition ends or is cancelled. When the user cancels a transition, UIKit executes your context block, calls the viewWillDisappear(_:) method on the presented view controller, and finally calls the viewWillAppear(_:) method on the original view controller to signal that it is once again visible.

Use the isInteractive property of the context object to determine the current interactivity of the transition. You can also use the value of the isCancelled property to determine an appropriate course of action. For example, if the transition was cancelled, you might remove any extra views that were added to the view hierarchy by a previous call to animate(alongsideTransition:completion:) or animateAlongsideTransition(in:animation:completion:).

You can call this method multiple times to register multiple blocks. All of the registered blocks are executed when the transition state changes.

See Also

Responding to View Controller Transition Progress

func notifyWhenInteractionEnds((UIViewControllerTransitionCoordinatorContext) -> Void)

Registers a block to be executed when a transition changes from interactive to non-interactive.

Required.

Deprecated

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software