100 Days of SwiftUI
2026-05-20
Project 6, part one
Learning about animations — ways to bring our app to life.
Animation: Introduction
Besides making our apps look more interesting, animations can give users clues to what’s going on with the program
Creating implicit animations
- simplest type of animation
scaleEffect()changes the scale of the view — 1 is the normal size- using a negative number on
scaleEffect()rotates the view 180° (not flipped, because it’s not mirror text)
Customizing animations in SwiftUI
- can specify the type of animation —
.defaultis a gentle spring;.linearis boring - need to supply a
value:for.animationto track otherwise it will happen whenever something happens to the view (like rotating your phone) - also
.spring,.easeInOuthave duration, can be delayed, repeated (even forever!), etc .overlayis useful for combining effects
Animating bindings
animation()can be applied to bindings, which makes the animation go between its current and new values- including
Bools!
- including
- you can attach the animation directly to a
$boundValue
Creating explicit animations
- want to animate (something) when there is an arbitrary state change
- not attached to a
Viewor$binding
- not attached to a
- to make Swift wait until there’s a particular state change, use the
withAnimation {}function
SO MUCH SYNTAX! How am I supposed to learn what I can do? The Apple developer docs are not exactly newb-friendly.