Skip to content

Instantly share code, notes, and snippets.

@lucasecf
Created March 6, 2018 18:43
Show Gist options
  • Save lucasecf/8c200729dd48ca3d757285606d17d123 to your computer and use it in GitHub Desktop.
Save lucasecf/8c200729dd48ca3d757285606d17d123 to your computer and use it in GitHub Desktop.
struct GetMoviesTask {
let dispatcher: AnyDispatcher<URLRequest, Data>
func load(success: ([Movie]) -> Void, failure: (Error) -> Void) {
let request = URLRequest(url: URL(string: “www.mydomain.com/movies")!)
  dispatcher.execute(request: request, success: { (data) in
  let movies = // (…)
  success(movies)
  }, failure: { error in
// (…)
  })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment