The standard way to respond to a UIButton tap, is:
- Statically link a method and tap event with
IBAction
. - Use a
UITapGestureRecognizer
, specifyingtarget
andaction
(a selector).
I want the event handlers to be swift block
/closure
, they are more flexible (no specific target/action), and allows reconfiguration.
Is there a way to do this without jumping through the hoops of target/actions?
I am using Swift 3, by the way.
And I have read this Question, which uses a private method: Gesture Recognizers and Blocks