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 trialboris said
3,607 Pointsrawvalue is being treated as a member in the enum how do i stop it
enum Day: Int {
case Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7
}
func daysTillWeekend(day: Day) -> Int {
return Day.Saturday.rawValue - Day.rawValue
}
2 Answers
Jhoan Arango
14,575 PointsHello Boris:
Sorry for the delay, but everything looks good on your code, the only thing is that you are returning Day.rawValue, when it should return the parameter in your function day.rawValue.
Thatβs it done.
I also fixed your question so that the code can be displayed properly.
Dee Hersi
779 PointsHas the .rawValue been removed in the latest version of Swift? I'm running into the same problem. I don't see it coming up in the dot syntax bar and rawValue is being treated as a member of the enum.
It says 'Day does not have a member named rawValue'.
I used .hashValue instead. I don't know what that is, but it works.
Jhoan Arango
14,575 PointsHello Dee:
Perhaps if you show me your code I may be able to help. As far as I know, the rawValue still in swift.