Protocol

NSAnimatablePropertyContainer

A set of methods that defines a way to add animation to an existing class with a minimum of API impact.

Overview

The NSAnimatablePropertyContainer protocol 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.

An object's automatically animated properties are those for which NSAnimatablePropertyContainer finds and returns a CAAnimation object 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.

Topics

Getting the Animator Proxy

func animator()

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

Required.

Managing Animations for Properties

var animations: [NSAnimatablePropertyKey : Any]

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

Required.

func animation(forKey: NSAnimatablePropertyKey)

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

Required.

static func defaultAnimation(forKey: NSAnimatablePropertyKey)

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

Required.

Constants

Transition Animation Keys

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

See Also

View-Based Animations

class NSViewAnimation

An animation of an app's views, limited to changes in frame location and size, and to fade-in and fade-out effects.

class NSAnimationContext

An animation context, which contains information about environment and state.

typealias NSAnimation.Progress

The animation progress, as a floating-point number between 0.0 and 1.0.

enum NSAnimationEffect

The type for standard system animation effects, which include both display and sound.