Skip to content

Instantly share code, notes, and snippets.

@cacheleocode
Created December 10, 2018 13:30
Show Gist options
  • Save cacheleocode/c7a0e69add3fd10326319850e8dd6746 to your computer and use it in GitHub Desktop.
Save cacheleocode/c7a0e69add3fd10326319850e8dd6746 to your computer and use it in GitHub Desktop.
var timeAtPress: NSDate!
var timeElapsed: NSDate!
// presses began
self.timeAtPress = NSDate()
print("timeAtPress \(self.timeAtPress as Date)")
// presses ended
self.timeElapsed = NSDate()
print("timeElapsed \(Date().timeIntervalSince(self.timeAtPress as Date))")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment