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 Modeling Forecast Data An Icon Enum

Drew Carver
Drew Carver
5,189 Points

Why use an extension for the image var?

Why did he use an extension to implement the image var, rather than just put it directly in the WeatherIcon enum? Was is just for organization purposes?

Yes, you're right he mentioned it in a previous course that it's for organizing.

1 Answer

As Abdul already mentioned, yes it's for organising - as a kind of convention. Here is a nice and concise read on the subject: Using Swift Extensions The β€œWrong” Way