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 Enumerations and Optionals in Swift Objects and Optionals Recap: Enumerations and Optionals

Which of the following sets of data would not be well suited modeled as an enumeration?

Which of the following sets of data would not be well suited modeled as an enumeration?

Months of the year

Authentication Status on an app

Types of ice cream

Planets in the Solar System

I am having trouble understanding the answer to this question. What thought process do you go through when determining what to use an enumeration for? I have read about them and am reviewing them but still don't get it.

1 Answer

Heidi Puk Hermann
Heidi Puk Hermann
33,366 Points

Enumerations are great when you have a finite number of choices; fx

12 months in a year - use enumeration 7 days in a week - use enumeration etc.

when you are creating a list of ice creams or baby names or something third, where you don't know the final number of entries, the use of an enumeration is a bad choice. Instead you should use a dictionary or an array to store your values, since you easily can append a new value or remove an old or obsolete one.