The minimum value of the slider is -1 the maximum value is +1.
@IBAction func changeContrast(_ sender: UISlider) {
DispatchQueue.main.async {
let beginImage = CIImage(image: self.myImageView.image!)
self.filter = CIFilter(name: "CIColorControls")
self.filter?.setValue(beginImage, forKey: kCIInputImageKey)
self.filter.setValue(sender.value, forKey: kCIInputBrightnessKey)
print("Current value of the slider - \(sender.value)")
self.filteredImage = self.filter?.outputImage
self.myImageView.image = UIImage(cgImage: self.context.createCGImage(self.filteredImage!, from: (self.filteredImage?.extent)!)!)
}
}
Also this the printed output od the sliders values.
Current value of the slider - 0.228814
Current value of the slider - 0.271186
Current value of the slider - 0.322034
Current value of the slider - 0.38983
Current value of the slider - 0.45339
Current value of the slider - 0.525424
Current value of the slider - 0.610169
Current value of the slider - 0.682203
Current value of the slider - 0.75
Current value of the slider - 0.79661
Current value of the slider - 0.847458
Current value of the slider - 0.889831
Current value of the slider - 0.915254
Current value of the slider - 0.927966