Instance Method

addCompletion(_:)

Adds the specified completion block to the animator.

Declaration

func addCompletion(_ completion: @escaping (UIViewAnimatingPosition) -> Void)

Parameters

completion

A block to execute when the animations finish. This block has no return value and takes the following parameter:

finalPosition

The ending position of the animations. Use this value to determine whether the animations stopped at the beginning, end, or somewhere in the middle.

Discussion

Completion blocks are executed after the animations finish normally. If you call the stopAnimation(_:) method, the completion blocks are not called if you specify true for the method’s parameter. If you specify false for the parameter, the animator executes the completion blocks normally after you call the its finishAnimation(at:) method.

You may add completion blocks to an animator at any time, including while it is stopped.

See Also

Modifying Animations

func addAnimations(() -> Void)

Adds the specified animation block to the animator.

func addAnimations(() -> Void, delayFactor: CGFloat)

Adds the specified animation block with a delay.