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!

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 2.0 Functions Function Parameters Returning Complex Values

I am having trouble finding out what this means by returning tuple.

I have made this to where it does return the coordinate values, but I am having trouble as to what it keeps asking for with the tuple value.

func getTowerCoordinates(location: String) {
    switch location {
    case "Eiffel Tower": (48.8582, 2.2945)
    case "Great Pyramid": (29.9792, 31.1344)
    case "Sydney Opera House": (33.8587, 151.2140)
    default: (0,0)
return location

1 Answer

Tuple is where you return more than variable. Try adding something like this above the switch:

let lat = 0 let long = 0

then adjust your switch to something like:

case "Eiffel Tower": lat = 48.8582, long = 2.2945

then finally a return:

return (lat, long)