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 trialSteven Alvarez
5,509 PointsThe Preview button to see compiler errors is missing
The error is asking me to check the compiler errors but the button is completely missing from this challenge.
1 Answer
jcorum
71,830 PointsRight, it's missing. What you can do in that case, if you have Xcode installed, is copy the code to a playground and fix any errors there. Since you didn't include your code I can't discuss changes, but here's a version the Challenge accepts:
protocol ColorSwitchable { //the requested protocol
func switchColor(color: Color)
}
enum LightState {
case On, Off
}
enum Color {
case RGB(Double, Double, Double, Double)
case HSB(Double, Double, Double, Double)
}
class WifiLamp: ColorSwitchable {
let state: LightState
var color: Color
init() {
self.state = .On
self.color = .RGB(0,0,0,0)
}
func switchColor(color: Color) { //the method the protocol requires to be implemented
self.color = color //changing the member variable color to the value of the parameter
}
}