I am creating a test app to get used to WatchKit, and was wondering if it possible to use a slider to set a countdown time. I have this so far:
import WatchKit
import Foundation
class InterfaceController: WKInterfaceController {
@IBOutlet weak var footText: WKInterfaceLabel!
@IBOutlet weak var timerOutput: WKInterfaceTimer!
@IBAction func button() {
}
@IBAction func timeSlider(value: Float) {
var myValue = String(format: "Value is %f", value)
func setAttributedText(attributedText: NSAttributedString?) {}
}
var testtest = "This is a test"
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()
}
}
Is it possible to change the value of the timer?
If you want to change the value of your timer, you can set it like this :
After that you can set the timer, depending on your countTime:
timer.setDate(NSDate(timeIntervalSinceNow: countTime)) timer.start()
Hope this helps!