-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# TITimer | ||
Pretty timer ⏰ | ||
## Pretty timer ⏰ | ||
|
||
The library allows you to create a timer that works either with [RunLoop](#Runloop) or with [GCD](#GCD). | ||
|
||
### Features | ||
|
||
- Track the time even while the application is in the background. For more, see - [TimerRunMode](/Sources/TITimer/Enums/TimerRunMode.swift) | ||
- Create a timer on a personal queue or on a special Runloop mode. For more, see - [TimerType](Sources/TITimer/Enums/TimerType.swift) | ||
- The code is covered by tests 🙂 | ||
|
||
### Examples | ||
|
||
#### RunLoop | ||
|
||
```swift | ||
timer = TITimer(type: .runloopTimer(runloop: .current, mode: .default), mode: .activeAndBackground) | ||
|
||
timer.eventHandler = { | ||
// handle elapsed time | ||
} | ||
|
||
timer.start() | ||
timer.invalidate() | ||
``` | ||
#### GCD | ||
|
||
```swift | ||
timer = TITimer(type: .dispatchSourceTimer(queue: .main), mode: .activeAndBackground) | ||
|
||
timer.eventHandler = { | ||
// handle elapsed time | ||
} | ||
|
||
timer.start() | ||
timer.invalidate() | ||
``` |