Created
November 28, 2018 20:17
-
-
Save cacheleocode/82bae3933585936c0424b02e938a0fbd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { | |
debugPrint("woo") | |
var restartTimer = true | |
if let gotEvents = event?.allPresses { | |
// At least one touch in progress? Do not restart timer, just invalidate it | |
for gotEvent in gotEvents.enumerated() { | |
if gotEvent.element.phase != .cancelled && gotEvent.element.phase != .ended { | |
restartTimer = false | |
break | |
} | |
} | |
} | |
if restartTimer { | |
// Touches ended || cancelled, restart timer | |
// print("Touches ended. Restart timer") | |
myVC?.doRestartTimer() | |
} else { | |
// Touches in progress - !ended, !cancelled, just invalidate it | |
// print("Touches in progress. Invalidate timer") | |
myVC?.doInvalidateTimer() | |
} | |
super.sendEvent(event!) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment