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 trialBrian Law
4,099 PointsI'm having trouble with Enum Methods
The challenge states that there's a compiler error, but the compiler doesn't return any errors. Furthermore, the code works in Xcode. It seems like something I'm doing doesn't line up with what the challenge wants, but I'm not sure what and I'm not sure why it thinks it's a compiler issue. Any help would be appreciated. Thanks!
2 Answers
Aniruddha Shukla
2,846 PointsLooked at your posted image. Code looks correct. This is dumb but try changing the method signature to just how they want it in the challenge.
func button() -> UIBarButtonItem
Brian Law
4,099 PointsThanks! That was it. For anyone else having issues with this problem, I'll also point out that the error message and the problem were inconsistent with what they wanted the name of the constant to be. The error calls for doneButton
and the challenge calls for button
and button
is the one that works
Pavel Fomchenkov
20,897 PointsCan confirm. I got two different error messages telling me that the final constant should be named either done
or doneButton
, but the real answer is that it should be called the neither of both. Call it just button
.
Also after you implement the func button() -> UIBarButtonItem
correctly, you will need these lines to make the parser happy:
let done = BarButton.done(title: "Save")
let button = done.button()
Brian Law
4,099 PointsBrian Law
4,099 Pointshttps://teamtreehouse.com/library/enumerations-and-optionals-in-swift-3/introduction-to-enumerations/enum-methods