https://github.com/meniny/easygcd
💯A tiny library to make using GCD easier.
https://github.com/meniny/easygcd
Last synced: about 1 year ago
JSON representation
💯A tiny library to make using GCD easier.
- Host: GitHub
- URL: https://github.com/meniny/easygcd
- Owner: Meniny
- License: mit
- Created: 2017-07-19T09:41:37.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-04-06T08:31:12.000Z (about 7 years ago)
- Last Synced: 2025-04-08T05:03:28.787Z (about 1 year ago)
- Language: Swift
- Size: 387 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## What's this?
`EasyGCD` is a tiny library to make using GCD easier. written in Swift.
## Requirements
* iOS 8.0+
* macOS 10.10+
* watchOS 2.0+
* tvOS 9.0+
* Xcode 8 with Swift 3
## Installation
#### CocoaPods
```ruby
pod 'EasyGCD'
```
## Contribution
You are welcome to fork and submit pull requests.
## License
`EasyGCD` is open-sourced software, licensed under the `MIT` license.
## Usage
```swift
dispatch {
// asynchronously on the main queue
}
main {
// asynchronously on the main queue
}
global {
// asynchronously on the global queue
}
```
```swift
import EasyGCD
func sync() {
EasyGCD.sync(.global(qos: .background)) {
print("sync @ background global queue")
}
}
func async() {
EasyGCD.async(EasyGCDQueue.global(.background)) {
print("async @ background global queue")
}
EasyGCD.async {
print("async @ main queue")
}
}
func after() {
EasyGCD.after(2.0) {
print("2 seconds later")
}
EasyGCD.after(4, queue: .global(qos: .default)) {
print("4 seconds later")
}
EasyGCD.after(DispatchTime.now() + 6, queue: .main) {
print("6 seconds later")
}
}
func once() {
EasyGCD.once(token: "Once") {
print("Once")
}
}
```