Skip to content

Instantly share code, notes, and snippets.

@lucasecf
Created March 4, 2018 22:01
Show Gist options
  • Save lucasecf/bba6d8379de06ccd27e9cff9820dfad4 to your computer and use it in GitHub Desktop.
Save lucasecf/bba6d8379de06ccd27e9cff9820dfad4 to your computer and use it in GitHub Desktop.
struct AnyDispatcher<R, O>: Dispatcher {
private let _execute: (R, (O) -> Void, (Error) -> Void) -> Void
init<D: Dispatcher>(_ dispatcher: D) where R == D.Request, O == D.Output {
_execute = dispatcher.execute
}
func execute(request: R, success: (O) -> Void, failure: (Error) -> Void) {
  _execute(request, success, failure)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment