Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Last active March 30, 2017 22:13
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 chelseatroy/3d0c9da1bf175b54ec3dcae34d8b4dbf to your computer and use it in GitHub Desktop.
Save chelseatroy/3d0c9da1bf175b54ec3dcae34d8b4dbf to your computer and use it in GitHub Desktop.
Asynchronous Calls With FutureKit
import FutureKit
import UIKit
class VillainsMasterViewController: UIViewController {
let villainService: VillainService?
...
func viewDidLoad() {
villainService?.getVillainList()
.onSuccess() { (apiRootResourceLinks) in
//display villain information in view
}.onCancel {
//tell the user that the villain call got cancelled
}.onFail { (error) in
//show the villain app error page
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment