Last active
August 3, 2017 14:37
-
-
Save codePrincess/a05de638adf98be14ea582d9e4aed1d6 to your computer and use it in GitHub Desktop.
timer for tracking the users doodling coordinates
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
public func setup () { | |
resetDoodleRect() | |
lastTouchTimestamp = 0 | |
if #available(iOS 10.0, *) { | |
trackTimer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true, block: { | |
timer in | |
let now = Date().timeIntervalSince1970 | |
if Int(self.lastTouchTimestamp!) > 0 && now - self.lastTouchTimestamp! > 1 { | |
self.drawDoodlingRect(context: self.context) | |
} | |
}) | |
} else {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment