Type Safely

Type Safely

Share this post

Type Safely
Type Safely
Turn Any View Into a Toggle Using One Simple Modifier

Turn Any View Into a Toggle Using One Simple Modifier

Daily Coding Tip 095

Millie Sturgeon's avatar
Millie Sturgeon
Jun 01, 2022
∙ Paid

Share this post

Type Safely
Type Safely
Turn Any View Into a Toggle Using One Simple Modifier
Share
Image by Evgeni Tcherkasski from Pixabay

In yesterday’s Daily Coding Tip I was talking about adding a @State property wrapper to a ViewModifier, but what happens when I use a @Binding?

It’s pretty easy to have a Button that uses the view as a label, and it’s easy to toggle a Binding<Bool> as well.

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