Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Enumerations and Optionals in Swift Introduction to Enumerations Enums with Associated Values

Stella Lu
Stella Lu
1,004 Points

What is wrong with this answer for this Enumerations & Optionals task?

I've searched, and it seems like there was an old version where there was a blackberry phone and the text was for "6S" not "7 Plus", but when I compare my code to the older version, it looks like my code follows the same rules. Why doesn't Treehouse accept this answer?

enums.swift
enum MobilePhone {
  case iPhone(String)
  case android(String)
  case windowsPhone(String)
}

let iphone = MobilePhone.iPhone("7 Plus")

1 Answer

David Papandrew
David Papandrew
8,386 Points

It may seem a bit silly, but you need to declare "iPhone" as "iphone" (all lowercase). Do this in the enum and the iphone constant declaration and it should pass.

Stella Lu
Stella Lu
1,004 Points

Wow - didn't notice that tiny detail, but it works! Thanks. :)