I want to assign the minimum and maximum value forWKInterfaceSlider
( WatchKit ) in the Swift code, not through the interface because I will get new values ( prices ) from the server.
which won't always be the same. In my current code I receive an error when i use this command with the Double value, highestBid
WKInterfaceSlider.setValue(highestBid)
Error:
Cannot invoke 'setValue' with an argument list of type '(Double)'.
import Foundation
import WatchKit
import UIKit
class slideViewController: WKInterfaceController {
@IBOutlet weak var lblPrice: WKInterfaceLabel!
@IBOutlet weak var slider: WKInterfaceSlider!
@IBOutlet weak var bidBtn: WKInterfaceButton!
@IBAction func sliderButton(value: Float) {
var kavelPrice:Double = 6000
var bidAmounts:Double = (kavelPrice / 100 * 2)
var midPrice:Double = (bidAmounts * 5 )
var highestBid:Double = (midPrice + kavelPrice)
var lowestBid:Double = kavelPrice
slider.setValue()
let roundedValue = Int(round(value))
self.lblPrice.setText("\(roundedValue)")
}
@IBAction func bidPrice() {
}
}
You cannot set the a minimum or maximum value for a WKInterfaceSlider
in code. These values can only be set in interface builder. See the documentation for more details.