I am in a situation wherein I have a UIView that I have added a subclassed UIGestureRecognizer to. I am using the following code;
class ButtonGestureRecognizer: UIGestureRecognizer {
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
//
state = .began
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) {
//
state = .ended
}
}
This allows me to capture the touch "down" and touch "up" event, which I am using to scale the UIView larger when it is pressed down and back to its normal size when it is released.
I also need to add a UILongPressGestureRecognizer to this same view, wherein it will also scale up when held down, and return to its normal size when it is released, but perform a different action.
However, the subclassed Gesture Recognizer seems to be preventing the UILongPressGestureRecognizer from working. The only solution I've found so far is to give up my subclassed gesture recognizer and use a UITapGestureRecognizer (with minimum taps required set to one) and a UILongPressGestureRecognizer, but then I give up the ability to properly detect the tap/press began and end states.
Any way around this? Thanks!