iOS & Swift

iOS Animations by Tutorials

A book on creating delightful iOS animations in Swift! From beginning to advanced topics like layer animations, view controller transitions, and more. By Marin Todorov.

Read for Free with the Personal Plan* * Includes this and all other books in our online library See all benefits
Buy Individually $59.99* *Includes access to all of our online reading features.
Leave a rating/review
Download materials
Buy paperback—Amazon Comments
Save for later
Share

Who is this for?

This book is for intermediate to advanced developers, who already know the basics of iOS and Swift development and want to dive deep into animations.

Covered concepts

  • SwiftUI
  • View Animations
  • Springs
  • Transitions
  • Keyframe Animations
  • Animation and Auto Layout
  • Layer Animations
  • Shapes and Masks
  • Gradient Animations
  • Stroke and Path Animations
  • 3D Animations
Make Delightful Animations with Swift!

This book is for iOS developers who already know the basics of iOS and Swift, and want to dive deep into animations.

Start with basic view animations and move all the way to layer animations, animating constraints, view controller transitions, and more!

more

Before You Begin

This section tells you a few things you need to know before you get started, such as the hardware and software you’ll need, where to find the project files for this book and more.

Section I: Animations With SwiftUI

SwiftUI is a modern cross-platform declarative UI framework from Apple. SwiftUI supports all Apple platforms so, as a cool bonus, you can apply anything you learn in this section to any of your tvOS, macOS, iPadOS and watchOS apps!

In this section, you’ll work through several different animations including some beautiful thumbnail zoom transitions and a modern-looking SwiftUI spinner.

In this chapter you will learn about the very basics of SwiftUI animations and then quickly move onto to more complex and visually interesting animations in a real life project.
2
Toggle description
You will continue to learn more about various view properties you can easily animate with SwiftUI. Additionally you will learn about view transitions and gesture driven interactive animations.

Section II: View Animations

This section will introduce you to the animation API of UIKit. Though simple to use, the UIKit animation API provides you with lots of flexibility and power to handle most, if not all, of your animation requirements.

Animations are visible, onscreen effects that apply to all of the views, or visible objects, in your user interface. You can animate any object onscreen that ultimately inherits from UIView. This includes UILabel, UIImageView, UIButton and any custom classes you’ve created yourself.

You’ll learn how to move, scale and fade views. You’ll create a number of different animations to get comfortable with Swift and the basic UIKit APIs.
4
Toggle description
You’ll build on the concepts of linear animation and create more eye-catching effects using spring-driven animations. Boiiing!
5
Toggle description
You’ll learn about several class methods in UIKit that help you animate views in or out of the screen. These one-line API calls make transition effects easy to achieve.
6
Toggle description
This chapter teaches you how to combine techniques you’ve already learned in creative ways to build up even cooler animations.
7
Toggle description
You’ll use keyframe animations to unlock the ultimate achievement of an impressive UI: creating elaborate animation sequences built from a number of distinct stages.

Section III: Auto Layout

You’ll need a slightly better understanding of the Auto Layout paradigm than the average iOS developer to make your animations play nicely with Auto Layout. Fortunately, you’ll find working with Auto Layout constraints in code isn’t as hard as it sounds at first. In fact, it’s a fairly straightforward process once you work through a few examples.

By the end of this section, you’ll have tamed Auto Layout and will know how to bend it to your will to create some really amazing animations.

Toggle description
This is a crash course on Auto Layout in case you’re not familiar with it already; you’ll need this for the next chapter.
Toggle description
Once you’ve worked through the project in Chapter 8, you’ll add a number of animations to it and put your newfound knowledge to good use.

Section IV: Layer Animations

In this section of the book, you’ll learn about animating layers instead of views and how to use special layers. A layer is a simple model class that exposes a number of properties to represent some image-based content. Every UIView is backed by a layer, so you can think of layers as the lower-level behind-the-scenes class behind your content.

By the end of this section, you will know how — and when! — to animate your views, and when it’s appropriate to use layers.

You’ll start with the simplest layer animations, but also learn about debugging animations gone wrong.
Toggle description
Here you gain more control over the currently running animations and use delegate methods to react to animation events.
Toggle description
In this chapter you combine a number of simple animations and run them together as a group.
Toggle description
In this chapter you learn how to use `CASpringAnimation` to create powerful and flexible spring layer animations.
Here you’ll learn about layer keyframe animations, which are powerful and slightly different than view keyframe animations. There’s some special handling around animating struct properties, which you’ll also learn about.
Toggle description
Draw shapes on the screen via CAShapeLayer and animate its special path property.
Toggle description
Learn how to use CAGradientLayer to help you draw and animate gradients.
Toggle description
Here you will draw shapes interactively and work with some powerful features of keyframe animations.
Toggle description
Learn about the little known but powerful CAReplicatorLayer class.

Section V: View Controller Transition Animations

It’s time to learn how to use UIKit and Auto Layout animation techniques in the broader context of app navigation and layout. You’ve animated multiple views and layers already, but now you’ll take a bigger-picture perspective and think about animating entire view controllers!

Implementing custom view controller transitions takes some coding, but the results are lots of fun to look at and use. No matter which API you use, custom transitions are an important animation technique that really make an app stand out!

Learn how to present view controllers via custom animated transitions.
You’ll build upon your skills with presenting view controllers and develop a really neat reveal transition for a navigation controller app.
Learn how to make the reveal transition interactive: the user will be able to scrub back and forth through the animated transition!

Section VI: Animations With UIViewPropertyAnimator

UIViewPropertyAnimator is a class that helps developers create interactive, interruptible view animations.

You could do everything you learned so far in the book by using a combination of layer and view animations, but UIViewPropertyAnimator wraps a number of APIs together conveniently in the same class, which makes it a bit easier to use.

After working through this section, you’ll definitely be at home with using UIViewPropertyAnimator for all kinds of animations in your apps!

Learn how to create basic view animations and keyframe animations. You’ll look into using custom timing that goes beyond the built-in easing curves.
In this chapter you are going to learn about using animators with Auto Layout. Further, you will learn how to reverse animations or make additive animations for smoother changes along the way.
Learn how to drive your animations interactively based on the user’s input. For extra fun you’ll look into both basic and keyframe animations interactivity.
Create custom View Controller transitions using a UIViewPropertyAnimator to drive the transition animations. You will create both static and interactive transitions.

Section VII: 3D Animations

Core Animation helps you float free from the two dimensional world of your app’s UI. Although it isn’t a true 3D framework, Core Animation has a lot of smart features to help you position two-dimensional objects in 3D space.

In the next two chapters, you’ll learn how to set up your layers in 3D space, how to choose the distance from the camera to your layer and how to create animations in your 3D scene.

Toggle description
Learn how to set up your layers in 3D space, how to choose the distance from the camera to your layer, and how to create animations in your 3D scene.
Toggle description
Go further into 3D space and learn about some of the more advanced ways to create 3D Animations.