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 Swift Enums and Structs Enums Enum Members and Raw Values

Srinivasan Senthil
Srinivasan Senthil
2,266 Points

Enumerations and Raw Value. Question please?

Hi All,

Please look at this video. https://teamtreehouse.com/library/swift-enums-and-structs/enums/enum-members-and-raw-values

Video playback from 5:50 to 6:10. I cannot understand what it means creating an instance of a day. Watched atleast 100 times. Can some one explain this in baby steps please.

Thanks - Srini

3 Answers

Gilberto De De Melo Junior
Gilberto De De Melo Junior
2,206 Points

Think of the Day enum as a blueprint: It has all the specifications of the enum. When you create an instance of Day, it basically means you are using your definition of the Day enum to create an object that will have all the specifications defined in your enum.

One example would be if you had a blueprint of a house, and then built a house with all the specifications from the blueprint. You can still call the blueprint "House", but when you actually build, aka "create" a house, you are creating an instance of the blueprint.

I believe saying "an instance of [something]" is very much used when you are talking about Object-Oriented programming.

Hope it helps!

Jesus Mendoza
Jesus Mendoza
23,289 Points

It means that you are accessing a variable of the enum Day