Reputation: 395
This is the first day I am learning how to code. I want to make a simple WatchKit App using watchOS 2.
I got the Hello World app up and running and now when I try to have a menu press trigger a label to change, the code won't compile, with the following error:
WKInterfaceLabel doesn't have a member called set.
You can see the detailed image here.
Swift Code:
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBOutlet var label: WKInterfaceLabel!
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
@IBAction func CookBabyCook() {
label.set("Cooked!")
}
}
Upvotes: 0
Views: 108
Reputation: 563
Label.set()
is the problem here.
I believe the label object doesn't have a set()
method. You must replace it with setText()
.
Upvotes: 3