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 and their Methods Methods or Member Functions

Timothy Tuite
Timothy Tuite
5,429 Points

Using date function

lets say i wanted to use the date function to get the day but i still wanted to use an enum how could i incorporate the return of the date function with the enum for example i wanted to do enum daysOfWeek {case Monday , Tuesday , Wednesday, Thursday , Friday, Saturday, Sunday} then func weekDayOrEnd(Input of dayofweek date function) { switch dayofweek { case monday-friday: println("weekday") case .saturday, .sunday: println("weekend" default: println("error") } } I know the syntax is probably off

Renato Nobre
Renato Nobre
5,805 Points

Hi Timothy, could you formact your question better? Put the code in the code module would be helpful, thanks!