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 trialjonlunsford
16,467 PointsCompiler errors are not showing in Preview.
I'm working on Task 2 of 2 in Swift 2.0 Enumerations and Optionals videos. I'm getting a "Bummer! Your code could not be compiled" message, but when I click Preview, there are no messages showing in red. It is a blank html file. Here is the code I am submitting:
import Foundation
enum UIBarButtonStyle {
case Done
case Plain
case Bordered
}
class UIBarButtonItem {
var title: String?
let style: UIBarButtonStyle
var target: AnyObject?
var action: Selector
init(title: String?, style: UIBarButtonStyle, target: AnyObject?, action: Selector) {
self.title = title
self.style = style
self.target = target
self.action = action
}
}
enum Button {
case Done(String)
case Edit(String)
func toUIBarButtonItem() -> UIBarButtonItem {
switch self {
case let .Done(doneTitle): return UIBarButtonItem(title: doneTitle, style: UIBarButtonStyle.Done, target: nil, action: nil)
case let .Edit(editTitle): return UIBarButtonItem(title: editTitle, style: UIBarButtonStyle.Plain, target: nil, action: nil)
}
}
}
let doneButton = Button.Done("Done").toUIBarButtonItem()
BTW... This is compiling in XCode just fine.
3 Answers
Florin Veja
6,912 Pointsjonlunsford,
I agree that your code looks ok and is compilable. It's possible that the backend server of teamtreehouse.com was having issues. Maybe refresh refreshing the page and trying again might help.
Florin
jonlunsford
16,467 PointsThis has been resolved. Thanks.
Florin Veja
6,912 Pointsjonlunsford,
Was this resolved by support? What was the solution?
Florin
jonlunsford
16,467 PointsYes it was resolved by Support. The challenge was a two step process and though the first part did not have any direct bearing on the second, by deleting it the compiler would not accept the second part. Rookie mistake!
jonlunsford
16,467 Pointsjonlunsford
16,467 PointsFlorin:
Thanks for your advice, unfortunately this did not help. I guess I will wait for Support to get in touch with me to figure this one out.