Puneet Puneet - 7 months ago 30
Swift Question

How do you round a UISlider to an int in swift

I was wondering how to round a UISilder value to a int value. Right now it is displaying floats. I am using swift 3 at the moment.

@IBOutlet var slidermove: UISlider!

@IBAction func SliderVal(_ sender: AnyObject) {

let x = round(slidermove)

round() does not work it will give an error, thanks for anyone that helps


Try Int(slidermove.value) instead this will parse it to an Int.