What if in that custom control, I would want to add the following additional behavior: if I touchDown on one of the two thumbsliders, I want to trigger some action.
How do I build that trigger?
Writing “sendActions(for: .touchDown)” into the “beginTracking” function does not seem to be the solution. What is the solution?
Independently from this question, and starting from your final App, if I add the line “sendActions(for: .valueChanged)” into the beginTracking function (and I do not change anything else), then when I click somewhere in the control, it triggers the action. I do not drag, just click. Why is that? What value changed that would have caused a .valueChanged event? Thank you for your thoughts!
When you add sendActions(for: .valueChanged) into the beginTracking function, it will begin get triggered when a touch happens, regardless whether it’s a drag or just a touch down. Apple Developer Documentation
For just touching down on either of the two thumbnails you could do something really simple like just add a .touchUpInside target to the rangeSlider in the ViewController like so: