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 ForecastService

Brian Patterson
Brian Patterson
19,588 Points

CurrentWeather closure ?

Let me get this straight. When getForecast gets called this executes the completion handler CurrentWeather. The information in the struct CurrentWeather will execute first and "Callback" to "getForecast" once this is done. Then the rest of the function is executed. I know this does not sound a very technical way of putting it but this is the only way my little brain works- plus it might help others. Also, I know this is a silly question, but why is there a Void after the closure of CurrentWeather?

1 Answer

Vinny Harris-Riviello
Vinny Harris-Riviello
11,898 Points

HI Brian,

My two cents. Void is the return value of the closure. Meaning it doesn't return anything. Hope that helps.