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 trialGreg Hughes
225 PointsI watched the video, if these aren't examples of associated values then what are?
I watched the video, if these aren't examples of associated values then what are?
enum MobilePhone {
case iphone(String)
case android(String)
case windowsPhone(String)
}
let iphone = MobilePhone.iPhone("7 Plus")
print(iphone)
2 Answers
Greg Hughes
225 PointsI found out what was wrong. the error I was getting from treehouse was incorrect. I called the member of the enum iPhone instead of iphone because after the directions tell you to label the member "iPhone", they tell you to make sure that you assign the member "iPhone" an associated value.
Also I don't know how to delete this thread, so ill just leave it here.
Jason Anders
Treehouse Moderator 145,860 PointsHey Greg,
Your code is correct, except a typo, which is causing a compiler error. When I copy/paste your code into the challenge I receive "error: enum type 'MobilePhone' has no case 'iPhone'; did you mean 'iphone'"
. This is where your typo is. In your assignment to the constant, you have an upper-cased "P" when is should be lower-cased.
Fix that and it's all good!
Nice work! :)
Greg Hughes
225 PointsGreg Hughes
225 Pointswhen I hit check work, I get an error that says " Make sure your enum members contain associated values"