Skip to content

Instantly share code, notes, and snippets.

@olbrichj
Created March 21, 2018 11:51
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 olbrichj/02fd1d39f1f0a2b5b605a6121f680103 to your computer and use it in GitHub Desktop.
Save olbrichj/02fd1d39f1f0a2b5b605a6121f680103 to your computer and use it in GitHub Desktop.
class ViewController: UIViewController {
private let (promise, seal) = Guarantee<...>.pending()
func show(in: UIViewController) -> Promise<…> {
in.show(self, sender: in)
return promise
}
func done() {
dismiss(animated: true)
seal.fulfill(…)
}
}
// use:
ViewController().show(in: self).done {
...
}.catch { error in
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment