CBGPromise

CI Status Version License Platform

安装

CBGPromise 可以通过 CocoaPodsCarthage 进行安装。

CocoaPods

将以下行添加到您的 Podfile 中

pod "CBGPromise"

Carthage

将以下行添加到您的 Cartfile 中

github "cbguder/CBGPromise"

用法

一个简单的例子可能如下所示

import CBGPromise

class Client {
    func getValue() -> Future<String> {
        let promise = Promise<String>()

        someAsyncCall {
            promise.resolve("Test")
        }

        return promise.future
    }
}

class SimpleExample {
    func main() {
        let client = Client()

        client.getValue().then { value in
            print(value)
        }
    }
}

有关其他示例,请参见 Examples 文件夹。

作者

Can Berk Güder

许可

CBGPromise 在 MIT 许可下可用。有关更多信息,请参见 LICENSE 文件。