Member-only story
Chain Animations in Swift
One animation after another
Anyone who has use animations in Swift will have become (possibly unwillingly) familar with an animation pyramid. Look further for both an example of this, and how you can avoid being another pyramid victim.
Difficulty: Beginner | Easy | Normal | Challenging
Prerequisites:
- You can use a Single View Application or Playgrounds application showing the view controller. In either case Auto Layout is a big part of this. Tutorials? Playgrounds with the UI and Single View Application and Auto Layout.
Terminology
UIView: An object that manages the content for a rectangular area on the screen
The challenge
You might well have dabbled with animations in Swift. Good for you! They are fun, and we can see a problem developing if we start to chain animations using animateWithDuration:animations:completion:
it’s a mess! This could be a pyramid of DOOM.
This isn’t a fully working example, so this article will take us through a simple animation and how…