Swift Package Index


Simple promises in Swift, inspired by KSPromise


  • The latest stable release is v0.6.0. Released almost 2 years ago.
  • The last commit to master was over 1 year ago.

Swift Version Compatibility

  • v0.6.0 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • v0.6.0 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

CBGPromise

CI Status Version License Platform

Installation

CBGPromise is available through CocoaPods and Carthage.

CocoaPods

Add the following line to your Podfile:

pod "CBGPromise"

Carthage

Add the following line to your Cartfile:

github "cbguder/CBGPromise"

Usage

A simple example might look like this:

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)
        }
    }
}

For other examples, see the Examples folder.

Author

Can Berk Güder

License

CBGPromise is available under the MIT license. See the LICENSE file for more info.