https://github.com/kgn/kgnthread
A collection of helpful methods that wrap GCD
https://github.com/kgn/kgnthread
Last synced: 4 months ago
JSON representation
A collection of helpful methods that wrap GCD
- Host: GitHub
- URL: https://github.com/kgn/kgnthread
- Owner: kgn
- License: mit
- Created: 2016-01-25T02:35:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-06T05:09:00.000Z (about 9 years ago)
- Last Synced: 2025-03-01T21:23:51.462Z (5 months ago)
- Language: Swift
- Homepage:
- Size: 19.5 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KGNThread
`KGNThread` is a collection of helpful methods that wrap [Grand Central Dispatch](https://en.wikipedia.org/wiki/Grand_Central_Dispatch).
[](/releases)
[](/LICENSE)[](https://travis-ci.org/kgn/KGNThread)
[]()
[](https://github.com/Carthage/Carthage)
[](https://cocoapods.org/pods/KGNThread)
[](https://cocoapods.org/pods/KGNThread)[](http://twitter.com/iamkgn)
[](https://github.com/kgn)
[](https://github.com/kgn/KGNThread)## Installing
### Carthage
```
github "kgn/KGNThread"
```### CocoaPods
```
pod 'KGNThread'
```## Examples
Each method is called with an optional delay, and a block to execute on the thread.
### Main
Dispatch on the main thread, useful for updating the UI from a background thread.
``` Swift
Thread.Main {
// Do something on the main thread
}Thread.Main(delay: 2) {
// Do something on the main thread,
// after a 2 second delay
}
```### Disk
Dispatch on a serial queue reserved for disk access.
``` Swift
Thread.Disk {
// Write to disk...
}
```### Global
Dispatch on the global threads: `high`, `low`, `default`, `background`.
``` Swift
Thread.High {
// Do something high priority
}Thread.Low(delay: 5) {
// Do something low priority,
// after a 5 second delay
}
```## Progress
- [X] Badges
- [X] Tests
- [X] Travis
- [X] Carthage
- [X] CocoaPods
- [X] Description
- [X] Documentation
- [X] AppleTV
- [X] AppleWatch
- [X] Prebuilt Frameworks
- [ ] Travis Test Matrix