Skip to content

Instantly share code, notes, and snippets.

@AmatsuZero
Created January 1, 2019 08:23
Show Gist options
  • Save AmatsuZero/56b919174a8eed1b82024639ec12922c to your computer and use it in GitHub Desktop.
Save AmatsuZero/56b919174a8eed1b82024639ec12922c to your computer and use it in GitHub Desktop.
DispatchTime 便捷方法
extension DispatchTime: ExpressibleByIntegerLiteral {
public init(integerLiteral value: Int) {
self = DispatchTime.now() + .seconds(value)
}
}
extension DispatchTime: ExpressibleByFloatLiteral {
public init(floatLiteral value: Double) {
self = DispatchTime.now() + .milliseconds(Int(value * 1000))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment