I have implement UITapGestureRecognizer and UILongPressGestureRecognizer on button click. My problem is when i tapped first time on button its not working but second time when i press the button its start working.
let longGesture = UILongPressGestureRecognizer(target: self, action: #selector(longTap(_:)))
longGesture.minimumPressDuration = 0.5
button.addGestureRecognizer(longGesture)
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(normalTap(_:)))
tapGesture.delegate = self
tapGesture.numberOfTouchesRequired = 1
tapGesture.numberOfTapsRequired = 1
button.addGestureRecognizer(tapGesture)
@objc func longTap(_ sender: UIGestureRecognizer){
print("long tap")
}
@objc func normalTap(_ sender: UIGestureRecognizer){
print("Normal tap")
}