Swift 2.2 version for rdelmar answer
@IBOutlet weak var slider: UISlider! func animateSlider(sender: AnyObject){ UIView.animateWithDuration(2, animations: {() in self.slider.setValue(0.75, animated: true) }, completion:{(Bool) in UIView.animateWithDuration(2, animations: {() in self.slider.setValue(0.25, animated: true) }) }) }
and to call the function pass UISlider in parameter
animateSlider(self.slider)
Abdullah saeed
source share