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

I am unable to successfully compile the correct code for the Tuple Extra Credit task. Can anyone help?

Task: Write a function that accepts a Dictionary as parameter and returns a named tuple. The dictionary should contain the following keys: title, artist and album.

My current code is : func info (info: Dictionary) -> (title: String, artist: String, album: String) { let songInfo = ["Title": "DJ", "Artist": "Jamie Foxx", "Album": "Unpredictable"] return songInfo }

Have you found the solution yet?

1 Answer

try return (songinfo["title"]!, songinfo["artist"]!, songinfo["album"]!)