Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift Functions and Optionals Parameters and Tuples Decomposing a Tuple

What is the purpose of decomposing a Tuple?

Can someone name some practical applications when you would want to use a Tuple and when would you want to decompose a Tuple? Not quite getting the value of a Tuple in the real world.

1 Answer

Felix Salazar
Felix Salazar
3,879 Points

I see it like the HTTP codes, where you have a codeError (404) and a codeMessage (Page not found). This could be an interisting approach to develope an exception's handling system. Don't you think? For the decomposition, it's only a practical way to acces the variables; it lets the code be more readable (as naming the parameters).