© Jayant Varma 2019
J. VarmaSwiftUI for Absolute Beginnershttps://doi.org/10.1007/978-1-4842-5516-2_6

6. Drawing and Animation

Jayant Varma1 
Melbourne, VIC, Australia

We have looked at some of the elements and functionality of SwiftUI. While we have seen how to create lovely interfaces with composition, it could add a bit of pop if these could be alive. Animation brings the elements to life and makes them more interesting. In this chapter, we shall see some interesting ways to animate and make the elements interesting.


The traditional way of animation is to use a timer. The theory behind this is that the timer fires every number of seconds that we want, and when this timer fires, we can run the code to update or alter the properties of the ...

Get SwiftUI for Absolute Beginners: Program Controls and Views for iPhone, iPad, and Mac Apps now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.