EasyGCD 1.4.0

EasyGCD 1.4.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布上次发布2019年4月
SPM支持 SPM

Meniny 维护。



EasyGCD 1.4.0

  • Elias Abel

EasyGCD
Version Author Build Passing Swift
Platforms MIT
Cocoapods Carthage SPM

这是什么?

EasyGCD 是一个小巧的库,用于使使用 GCD 更简单,使用 Swift 编写。

要求

  • iOS 8.0+
  • macOS 10.10+
  • watchOS 2.0+
  • tvOS 9.0+
  • Xcode 8 配合 Swift 3

安装

CocoaPods

pod 'EasyGCD'

贡献

您被鼓励进行分支操作并提交补丁请求。

许可

EasyGCD 是开源软件,遵照 MIT 许可协议发布。

使用

dispatch {
  // asynchronously on the main queue
}

main {
  // asynchronously on the main queue
}

global {
  // asynchronously on the global queue
}
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")
    }
}