Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,275 Points

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