Protocol

NSAnimatablePropertyContainer

The NSAnimatablePropertyContainer protocol defines a way to add animation to an existing class with a minimum of API impact. It returns a proxy object for the receiver that can be used to initiate implied animation of property changes. An object's animator proxy should be treated as if it was the object itself, and may be passed to any code that accepts the object as a parameter. Sending of key-value-coding compliant "set" messages to the proxy will trigger animation for automatically animated properties of its target object.

Overview

An object's automatically animated properties are those for which NSAnimatablePropertyContainer finds and returns an CAAnimation instead of nil, often because animator() specifies a default animation for the key.

It's perfectly valid to set a new value for a property for which an animation that is currently in progress; this simply sets a new target value for that property, with animation to the new target proceeding from whatever current value the property has reached. An in-flight property animation can be stopped by setting a new value for the property bracketed by an NSAnimationContext with 0.0 as the duration.

Symbols

Getting the Animator Proxy

func animator()
Required.

Returns a proxy object for the receiver that can be used to initiate implied animation for property changes.

Managing Animations for Properties

var animations: [String : Any]
Required.

Sets the option dictionary that maps event trigger keys to animation objects.

func animation(forKey: String)
Required.

Returns the animation that should be performed for the specified key.

static func defaultAnimation(forKey: String)
Required.

Returns the default animation that should be performed for the specified key.

Constants

Transition Animation Keys

The following constants define the keys that reference the transitions used as views are made visible and hidden.