Created
February 22, 2018 11:36
-
-
Save nic004/29e810fbe9a474ebe806cc0a3588d2bb to your computer and use it in GitHub Desktop.
promise with ReactiveSwift #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| class Promise<Value, Error: Swift.Error> { | |
| ... | |
| @discardableResult func started(_ then: @escaping () -> Void) -> Promise<Value, Error> { | |
| sp.on(started: then) | |
| return self | |
| } | |
| @discardableResult func value(_ then: @escaping (Value) -> Void) -> Promise<Value, Error> { | |
| sp.on(value: then) | |
| return self | |
| } | |
| @discardableResult func completed(_ then: @escaping () -> Void) -> Promise<Value, Error> { | |
| sp.on(completed: then) | |
| return self | |
| } | |
| @discardableResult func failed(_ then: @escaping (Error) -> Void) -> Promise<Value, Error> { | |
| sp.on(failed: then) | |
| return self | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment