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 Network Programming with Swift 2 Implementing a Forecast Client Testing the Networking Stack

Alexander Kvamme
Alexander Kvamme
1,707 Points

"let currentWeather"?

How does this work? Usually you have to set the variable equal to something. But here you are just making a variable and we assume that swift will fill it with the APIResult? Is it some kind of syntactic sugar? Not quite sure what to google to read about this.

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Alexander,

When you do this, you are "initializing an empty variable" to be used as some point later on. Swift won't "fill in the data" by itself, at some point there will be code that will add a value to the current empty variable.

Try searching "Empty variables in Swift" or "Initialize an empty variable in Swift"

Keep Coding! :) :dizzy: