In Swift Playgrounds Sphero Arcade 1, on the exercise “Back and Forth”, I’m having trouble setting the LED color. Can anyone help?
Here is the code I put into my project:
var currentPlayer = 1
func onCollision(data: CollisionData) {
stopRoll()
if currentPlayer == 1 {
currentPlayer = 2
setMainLed(color: UIColor.green) ERROR: Cannot find “UIColor” in scope
volley(baseAngle: 180)
} else {
currentPlayer = 1
volley(baseAngle: 0)
}
}
Here is the code I put into my project:
var currentPlayer = 1
func onCollision(data: CollisionData) {
stopRoll()
if currentPlayer == 1 {
currentPlayer = 2
setMainLed(color: UIColor.green) ERROR: Cannot find “UIColor” in scope
volley(baseAngle: 180)
} else {
currentPlayer = 1
volley(baseAngle: 0)
}
}