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

enum Compass: Int { case North = 1 case South case East case West } let direction = Compass(rawValue:

Help why this code is not passing the challenge.

enums.swift
enum Compass: Int {

  case North = 1
  case South 
  case East 
  case West
}
let direction = Compass(rawValue: 2)

//let me answer myself ,that one will pass because the strings are in lower case enum Compass: Int { case north = 1 case south case east case west } let direction = Compass(rawValue: 2)

2 Answers

//let me answer myself ,that one will pass because the strings are in lower case enum Compass: Int { case north = 1 case south case east case west } let direction = Compass(rawValue: 2)

Andy Alcantara
PLUS
Andy Alcantara
Courses Plus Student 20,801 Points

Try writing the cases in lowercase (case north case south....)