Sometimes you want to change the slider thumb image to something custom.
customSlider.setThumbImage(thumbImage, forState: .normal)
If you need to load the image from your assets, it’s best to do it safely in a if let
statement
if let thumbImage = UIImage(named: "thumb-image") {
customSlider.setThumbImage(thumbImage, forState: .normal)
}
Of course you can just define the image in the same line if you want:
customSlider.setThumbImage( UIImage(named: "thumb-image"), for: .normal)
The Complete iOS App Development Bootcamp
Disclosure: This website may contain affiliate links, meaning when you click the links and make a purchase, we receive a commission.