Created
January 22, 2019 20:39
-
-
Save greggjaskiewicz/a4b97f5e4ae9d326a6bc1a497db22cf4 to your computer and use it in GitHub Desktop.
TimeInterval extension with literal intervals commonly needed
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
extension TimeInterval { | |
static var second: TimeInterval { return 1 } | |
static var minute: TimeInterval { return 60 } | |
static var hour: TimeInterval { return 60 * self.minute } | |
static var day: TimeInterval { return 24 * self.hour } | |
static var week: TimeInterval { return 7 * self.day } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment