Explicit Animations with withAnimation
Wrap state mutations to control timing.
When You Want Control
Sometimes you want to decide exactly which change animates. withAnimation wraps a state change so its results tween.
The withAnimation Block
You put your state mutation inside withAnimation. Every view update caused by that change animates together.
withAnimation {
isExpanded.toggle()
}All lessons in this course
- Implicit Animations
- Explicit Animations with withAnimation
- Insertion & Removal Transitions
- Spring & Custom Timing Curves