1

I've created a custom UIControl. The closest comparison is a UIStepper but it is a subclass of UIControl because its wholly custom.

For most UIControls you can create target actions with primaryActionTriggered to avoid needing to know which action matters. I want the same convenience for my custom UIControl. So how do I map UIControl.Event.valueChanged to UIControl.Event.primaryActionTriggered?

Ryan Poolos
  • 18,421
  • 4
  • 65
  • 98

1 Answers1

3

I think if you are listening for the valueChanged event then you just need to manually call sendActions(for: .primaryActionTriggered) when that event fires

blackcoffee
  • 216
  • 2
  • 7
  • Never dawned on me it could be as simple as just sending both. Assumed there was some potentially private mapping step to make primary mean whatever the control wanted. ‍♂️ – Ryan Poolos May 20 '20 at 19:47