Search code examples
xcodemacosswiftnsslider

NSSLider Set Starting Value


I'm trying to get my NSSlider to start at a certain value, and I've been unable to find function to do that in the swift book or other resources. Is there an easy way to do this?

Thanks


Solution

  • You have to first create an outlet for your NSSlider:

    @IBOutlet weak var yourSlider: NSSlider!
    

    then you just have to set it's initial value as follow:

    yourSlider.doubleValue = 0.5