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 2.0 Enumerations and Optionals Objects and Optionals Enums with Raw Values

Works in a playground - doesn't work here

enum Compass: Int {
  case North = 1
  case Sounth
  case West
  case East
}

let direction = Compass(rawValue: 2)

Any idea?

2 Answers

Hi there,

I had a look at this challenge and found that this code worked (added commas between cases) - I am sure there are other solutions that will also pass the test:

enum Compass: Int{
  case North = 1,
  South,
  East,
  West
}

let direction = Compass(rawValue: 2)

I hope that helps.

Steve.

This does too - I think you mis-spelt South which is causing the issue:

enum Compass: Int{
  case North = 1
  case South
  case East
  case West
}

let direction = Compass(rawValue: 2)

Shame on me for that typo, thanks for mentioning this.