Skip to content

Instantly share code, notes, and snippets.

@dodikk
Created February 12, 2018 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dodikk/2175427874c98f0acf78b5b181541161 to your computer and use it in GitHub Desktop.
Save dodikk/2175427874c98f0acf78b5b181541161 to your computer and use it in GitHub Desktop.
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