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 What is an Enum?

Will Feldman
Will Feldman
3,121 Points

When every you are using a enum can you do the .value

Even when you reassigning the var today to Day.Sunday could you have just done this?

today = .Sunday

Because you have already declared that it is the enum Day?

No this will not work .Value syntax being used because here the
func weekdayOrWeekend ( dayOfWeek: Day ) ->String{} is stated in
func (parameter :Type){} allowing inner switch case can use .Value of enum as it is expecting Day.Value .... So ```enum Day{ case Value, OtherValue } func ( param : Day)-> String{
switch param{ case .Value: return "string yes" default: return "string no" }
}

Look at your **return values** they must be **->String** so variable will not be suitable