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

Enum init() doesn't seem to return an optional in Swift 2

It might be good to update the video description for errata related to Swift 2.

David Rynn
David Rynn
10,554 Points

I believe you're still getting an optional, but the playground doesn't complain. In the example if you pass in "10" into firstDayOfWeek, you still get a nil back, so best practices dictate that you still use the if let statement. No, Amit Bijlani ?

1 Answer

Sultan Mehrabi
Sultan Mehrabi
1,535 Points

There are many things that seem to have changed in Swift 2 but some googling usually resolves the misunderstanding. It would be great if the videos were updated for Swift 2 but that's probably a time consuming thing.

As David mentioned you still get an optional back.