Type Safely

Type Safely

A ColorPicker That Sets and Stores Your View's Foreground Colour Within a ViewModifier

Daily Coding Tip 094

Millie Sturgeon's avatar
Millie Sturgeon
May 31, 2022
∙ Paid
Image by Sergio Cerrato - Italia from Pixabay

Okay, so a ViewModifier isn’t the best place to store data.

But I’ve realised that I haven’t spent enough time thinking about what a ViewModifier can do, as it is a structure that can use a @State property wrapper.

Whatever view we apply this modifier to is turned into the label of a Button. This gives the use…

User's avatar

Continue reading this post for free, courtesy of Type Safely.

Or purchase a paid subscription.
© 2026 Type Safely · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture