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.
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
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!
moreBefore 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.
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.
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.
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.
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!
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!
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.