I was wondering if there was a way to force interrupt an UISwitch
dragging action? (seems dirty)
The problem:
On value change, my UISwitch
updates the state and sets .isUserInteractionEnabled
to false
, so further taps aren’t processed until async operation complete and state is then updated (unlocking the UISwitch
).
In the case where the user switches the UISwitch
by dragging it (tap and hold), it sets .isUserInteractionEnabled
to false
, but the user stays in control of the switch while holding the finger, and can then flip the UISwitch
as much he wants and bypass .isUserInteractionEnabled
.
When using a random UISwitch
in one of the iPhone Settings menu, you can also drag and drop a UISwitch
, but at some point the gesture/drag is cancelled and you lose control over it. I don’t see anything to do that in the public API of UISwitch
?
Or maybe I shouldn’t use valueDidChange()
? I don't see another reliable alternative.
Edit: A TL;DR version
The problem is: if the user hold his tap, even by disabling userInteractions he can still move the switch as long as he hold the initial tap.