Type Safely

Type Safely

Use Tuples In SwiftUI To Pass Just One Parameter To Any View

Daily Coding Tip 015

Type Safely's avatar
Type Safely
Jan 02, 2021
∙ Paid
Image by 107736 from Pixabay

I often find that I want to pass 3 or more parameters to a SwiftUI view. The problem with this is that it looks pretty messy. For example, I may want to make a colour picker, which will pass bindings to a VStack of sliders and constants to a preview like this:

SliderView(red: $red, green: $green, blue: $blue)
PreviewView(red: …
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