I have a code I am writing and its going well but I am having trouble with UISliders...specifically...setting values. I have used the sliders and now I want to reset them to the original state (0 to 10 with a value of 0 and the slider all the way to the left. I have...
@IBOutlet weak var redHorizontalSlider: UISlider!
redHorizontalSlider!.minimumValue = 0.0
redHorizontalSlider!.maximumValue = 1.0
redHorizontalSlider!.setValue(0.0, animated: false)
and when I print the values its giving me a nil and an error. I have played around with ! and ? in the declaration of the Object and the calls but to no avail.
I am new to Swift and I am learning as I go. I just need some expertise here. Thanks in advance.
This error is going to happen because the value of your slider is nil. Check your connections to make sure that your storyboard slider is connected to the slider variable.