Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TimeInterval extensions
extension TimeInterval {
var milliseconds: Int {
return Int(truncatingRemainder(dividingBy: 1) * 100)
}
var minutes: Int {
return Int(self / 60)
}
var seconds: Int {
return Int(truncatingRemainder(dividingBy: 60))
}
var display: String {
return String(format: "%02d:%02d", minutes, seconds)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.