shareup/dispatch-timer
`DispatchTimer` is a [GCD-powered timer](https://developer.apple.com/documentation/dispatch/dispatchsourcetimer) with a similar API to [`Timer`](https://developer.apple.com/documentation/foundation/timer) (née `NSTimer`). `DispatchTimer`'s big advantage over `Timer` is it doesn't
Installation
To use DispatchTimer with the Swift Package Manager, add a dependency to your Package.swift file:
dependencies: [
.package(url: "https://github.com/shareup/dispatch-timer.git", from: "3.0.0"),
],Usage
let oneoff = DispatchTimer(.milliseconds(50), block: { print("fired") })
let repeating = DispatchTimer(
.milliseconds(50),
repeat: true,
block: { print("fired") }
)
let fireAt = DispatchTimer(
fireAt: DispatchTime.now() + .milliseconds(50),
block: { print("fired") }
)License
The license for DispatchTimer is the standard MIT license. You can find it in the LICENSE file.
Package Metadata
Repository: shareup/dispatch-timer
Default branch: main
README: README.md