Chapter 11

Performing Animations in SwiftUI

IN THIS CHAPTER

check Seeing how you can animate in SwiftUI

check Repeating an animation

check Stopping an animation

check Rotating views in 2D and 3D

check Creating your own custom progress indicator

In Chapter 10, I show you how to draw different types of shapes in SwiftUI. To make your great-looking user interface (UI) even more interactive and appealing, it’s useful to animate some of the components. For example, you may want to create your own custom progress indicator for the app that you’re building. For this, you need to perform some animations. SwiftUI makes animating your views really simple. It hides the complexity of the work needed to handle complex animations and allows you to focus on what you want to animate.

In this chapter, I show you some of the techniques to perform animation in SwiftUI.

Understanding How to Animate

To animate a view in SwiftUI, apply the animation() modifier on it. SwiftUI animates any changes made to animatable properties of ...

Get SwiftUI For Dummies 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.