Created
March 4, 2018 17:45
-
-
Save lucasecf/31050dbd4aafa1a66ec62fa134ce55cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct HTTPDispatcher: Dispatcher { | |
func execute(request: URLRequest, success: (Data) -> Void, failure: (Error) -> Void) { | |
// executes HTTP requests using URLSession | |
// … | |
} | |
} | |
struct TestHTTPDispatcher: Dispatcher { | |
func execute(request: URLRequest, success: (Data) -> Void, failure: (Error) -> Void) { | |
// to be used for unit tests, returns mocked data | |
// … | |
} | |
} | |
struct GraphQLDispatcher: Dispatcher { | |
func execute(request: GraphQLQuery, success: (GraphQLQuery.Data) -> Void, error: (Error) -> Void) { | |
// Uses graphql lib to load data from server | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment