I am unable to get the TapTic Engine to generate a .selectionChanged()
when used with a UISegmentedControl
, but it works perfectly on a UISwitch
Here's the code:
@IBAction func languageSegmentedControlTouched(sender: UISegmentedControl)
{
self.tapticSelectionEngine?.prepare()
DispatchQueue.main.async { self.setLanguage(languageOption: sender.selectedSegmentIndex) ; self.tapticSelectionEngine?.selectionChanged() }
}
That does nothing.
But this does work:
@IBAction func movableToggleSwitchTouched(sender: UISwitch)
{
self.tapticSelectionEngine?.prepare()
switch sender.isOn
{
case YES:
self.tapticSelectionEngine?.selectionChanged()
// Do stuff
default:
self.tapticSelectionEngine?.selectionChanged()
// Do Stuff
}
}
If I replace the TapTic engine for the impact version then it works for the segmented controls, but I can't get the selection version working, despite the Apple docs saying this is the one I'm supposed to use.
I tried it without the async dispatch and no difference. I only tried that after reading this tutorial: