Last active
June 1, 2019 01:07
-
-
Save aybekckaya/da5aaf20b44e0dba5299fb807a7b2df4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TapGestureReplicator:UIGestureRecognizer { | |
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) { | |
// Checking the count of touches . | |
// If number of finger used in gesture is not equal to one , then gesture should fail. | |
guard touches.count == 1 , let _ = touches.first else { | |
self.state = .failed | |
return | |
} | |
self.state = .began | |
} | |
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent) { | |
guard touches.count == 1 , let _ = touches.first else { | |
self.state = .failed | |
return | |
} | |
self.state = .ended | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment