How to identify which UIControl.Event triggered a common selector for UIButton?

I’m working with UIButton and I’d like to register multiple UIControl.Events (e.g. .touchUpInside, .touchDown, .touchCancel, .primaryActionTriggered) using the same selector.

For example:

button.addTarget(self,
                 action: #selector(handleButtonEvent(_:forEvent:)),
                 for: [.touchUpInside, .touchDown, .touchCancel, .primaryActionTriggered])

@objc func handleButtonEvent(_ sender: UIButton, forEvent event: UIEvent) {
    // How do I tell which UIControl.Event triggered this?
}

From my understanding:

If I use the single-parameter version (@objc func handleButtonEvent(_ sender: UIButton)), I can’t distinguish which event fired.

If I use the two-parameter version with UIEvent, I can inspect touch.phase or event.type, but that feels indirect.

Questions:

Is there a recommended way to directly know which UIControl.Event caused the selector to fire?

Is sharing a single selector across multiple control events considered a good practice, or is it more common to register separate selectors per event?

Would appreciate guidance on what Apple recommends here.

That cannot work, unfortunately.

I tested for the event rawValue, to no avail, even after changing event type in the @objC:

     @objc func handleButtonEvent(_ sender: UIButton, forEvent event:  UIControl.Event) {
touchDown 1
touchDownRepeat 2
touchDragInside 4
touchDragOutside 8
touchDragEnter 16
touchDragExit 32
TouchUpInside 64
touchUpOutside 128
TouchCancel 256
PrimaryActionTriggered 8192

As explained here: https://stackoverflow.com/questions/31122418/in-swift-how-do-you-detect-which-uicontrolevents-triggered-the-action

Curiously, none of the action selector parameters provide any way to learn which control event triggered the current action selector call! Thus, for example, to distinguish a Touch Up Inside control event from a Touch Up Outside control event, their corresponding target–action pairs must specify two different action handlers; if you dispatch them to the same action handler, that handler cannot discover which control event occurred.

So you have to create a target action for each event.

How to identify which UIControl.Event triggered a common selector for UIButton?
 
 
Q