Add a simple object animation helps “add” – the specified animation object to the layer’s render tree.
If the duration property of the animation is zero or negative, the duration is changed to the current value of the kCATransactionAnimationDuration transaction property (if set) or to the default value of 0.25 seconds.
Parameters
anim
The animation to be added to the render tree. This object is copied by the render tree, not referenced. Therefore, subsequent modifications to the object are not propagated into the render tree.
key
A string that identifies the animation. Only one animation per unique key is added to the layer. The special key kCATransition is automatically used for transition animations. You may specify nil for this parameter.

Swift programming tutorial