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 Adding Weather Icons Assigning An Image

Vrezh Gulyan
Vrezh Gulyan
11,161 Points

Why aren't we using the raw values of the enum?

When I saw that we were repeating ourselves in this step it immediately threw up a red flag for me. My question is why don't we use the raw values from the enum that we created and add a .png to the end rather than risking a simple spelling error that crashes our app. The only issue I saw with this when I looked is that for our specific icons the file names aren't the same for all cases. E.g for the partly-cloudy-night case our file name is cloudy-night.png.

Aubrey Taylor
Aubrey Taylor
2,991 Points

I had this same thought! I would also say that it makes sense to probably just add a Default member to the Icon enum.

Aubrey Taylor
Aubrey Taylor
2,991 Points

A similar question was posted here: https://teamtreehouse.com/community/overcomplicated-enum

I added my final approach there as well.