Property Animators

As the documentation indicates, to animate a view you create and start a property animator, which is an instance of UIViewPropertyAnimator. This allows you to animate one of the animatable view properties that you see listed.

Basic animations

In Mandala, you are first going to animate the highlight view on the ImageSelector. When a mood is selected, the highlight will move smoothly instead of simply appearing behind the selected mood. Later in this chapter, you will animate color changes on both the highlight view and the add mood button.

Open Mandala.xcodeproj and navigate to ImageSelector.swift. Update imageButtonTapped(_:) to animate the highlight view.

Listing 19.1  Animating the highlight view’s ...

Get iOS Programming: The Big Nerd Ranch Guide, 7th Edition 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.