I have a function:
func handleChange(isShown:Bool){
if isShown {
// do something A
}else{
// do something B
}
}
If I want a UISlider to add the above action with the isShown defaulting to false, and I will call the method handleChange(isShown:Bool)
with true in another function.
The wrong code as follows:
slider.addTarget(self, action: #selector(handleValue(isShown:false)), for: .valueChanged)
And I know the right code needs to be:
slider.addTarget(self, action: #selector(handleValue(isShown:)), for: .valueChanged)
I just want to know how can I set the 'isShown' as false in swift? Appreciate you can reply.