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 Build a Weather App with Swift Managing Complexity Modifying CurrentWeather

Wameedh Mohammed Ali
Wameedh Mohammed Ali
5,150 Points

long: coordinate?????!!!

Why do we need to include 'long:' before: 'coordinate.long' wihle we include 'lat:' 'before coordinate.lat' ?

forecastService.getForecast(coordinate.lat, long: coordinate.long){ (let currently) in if let currentWeather = currently { //Update UI }

1 Answer

In Swift, the name of the first parameter in a function is omitted by default. You can read more about it in Apple's Swift documentation under "Function Parameter Names." You can certainly add "lat:" in front of coordinate.lat if you want to add some clarity to the function declaration...it will still work fine!