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.
- macOS 10.10+
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.