Implicit Animation and Actions

Before we talk about what is going on in presentImage(_:), let’s look at how the most basic animation is done with Core Animation. Imagine that you have a CALayer called layer that is displayed on the screen. Suppose that you set its position like so:

l​a​y​e​r​.​p​o​s​i​t​i​o​n​ ​=​ ​C​G​P​o​i​n​t​(​x​:​ ​5​0​,​ ​y​:​ ​5​0​)​

This simple action animates the layer from its current position to the new position: implicit animation. Many properties of layers can be animated by simply setting them. The didSet observer of the text property uses implicit animation to change the size of the black status bubble.

What if you want to customize these animations? As it turns out, there are several styles for ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.