Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Specify The Animation That Happens When a Toggle Changes State

Specify The Animation That Happens When a Toggle Changes State

Daily Coding Tip 193

Type Safely's avatar
Type Safely
Oct 12, 2022
∙ Paid

Share this post

Type Safely
Type Safely
Specify The Animation That Happens When a Toggle Changes State
Share
green light bulb on white surface
Photo by Isaac Li Shung Tan on Unsplash

It’s possible to specify an animation when adding a Binding<Bool> to a Toggle.

I expected $myBinding.animation() would return an animation, and it would therefore not be suitable for use as a Binding<Bool>.

However, it turns out that this function is really just informing SwiftUI of your intention without actually r…

Keep reading with a 7-day free trial

Subscribe to Type Safely to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Type Safely
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share