Member-only story

The 2 Must-Know Protocols for SwiftUI Animation

Animatable and AnimatableModifier are essentials to create SwiftUI animations

Eric Yang
Better Programming
4 min readAug 17, 2020

Photo by Zhifei Zhou on Unsplash

When using SwiftUI, it’s important to animate views and transitions with silky smooth performance. This article introduces the two protocols for SwiftUI animation that every developer must know.

1. The Animatable Protocol

The Animatable protocol
Photo by Simon Berger on Unsplash

The Animatable protocol is available on iOS 13+. It defines the type that can be animated. The only value the protocol contains is animatableData which is the associated type of VectorArithmetic. VectorArithmetic extends the AdditiveArithmetic protocol with scalar multiplication and a way to query the vector magnitude of the value. The Animatable protocol helps us in animating paths and transforming matrices.

SwiftUI traverses the view hierarchy to find the values adopt Animatable protocol and…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Eric Yang
Eric Yang

Written by Eric Yang

Senior iOS engineer🚀, double degrees with Computer Science⚡Content writer? Why not!🚀

No responses yet

Write a response