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 (Retired) Data Modeling With Structures Setting Icon Images

Bram Grooten
Bram Grooten
2,415 Points

Why don't we get an error for "using self before all properties are defined", like we did with currentTime?

We couldn't use our dateStringFromUnixTime function to initialize currentTime at first, because we had to move this to the end of the init() method. This would make sure that all other properties would have values. But now we're using another function, and setting the value of "icon" later than using the dateStringFromUnixTime function to initialize currentTime! How is this possible?

Bram Grooten
Bram Grooten
2,415 Points

Nevermind! I forgot that we solved this using Optional values for both currentTime and icon.