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
1
4
Share
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: …

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