Last active
July 5, 2023 20:17
-
-
Save FlorianMielke/284ba01b9715584edf4eca8ad70f457b to your computer and use it in GitHub Desktop.
A simple convenience extension to Int when working with TimeInterval
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
import Foundation | |
public extension Int { | |
var seconds: TimeInterval { TimeInterval(self) } | |
var second: TimeInterval { seconds } | |
var minutes: TimeInterval { seconds * 60 } | |
var minute: TimeInterval { minutes } | |
var hours: TimeInterval { minutes * 60 } | |
var hour: TimeInterval { hours } | |
var day: TimeInterval { hours * 24 } | |
var days: TimeInterval { day } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of writing
you write: