Created
February 12, 2018 17:46
-
-
Save dodikk/2175427874c98f0acf78b5b181541161 to your computer and use it in GitHub Desktop.
This file contains 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
import FutureKit | |
extension Promise { | |
func getCallbackForService() -> ( (Result<T>) -> Swift.Void ) | |
{ | |
return self.completeWithResult | |
} | |
func completeWithResult(result: Result<T>) { | |
switch result { | |
case .success(let value): | |
self.completeWithSuccess(value) | |
case .error(let error): | |
self.completeWithFail(error) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment