Deloitte Digital simple networking library.
Integrate the library with your project using CocoaPods.
TODO: Integrate with trunk and provide integration examples
Before using the library in your app (i.e. in your AppDelegate), call:
DDRouter.initialise(configuration: URLSessionConfiguration.default)
passing in a URLSessionConfiguration object - in most cases the URLSessionConfiguration.default configuration will be appropriate.
- Define your endpoints in an enum, then implement the EndpointType protocol on your endpoint enum.
- Define your APIs error model in a struct that implements APIErrorModelProtocol.
- To make a request, create a Router object, passing in your endpoint type and API error model as generic parameters. Then call request() with the endpoint case as a parameter.
- To have the API deserialise your response type correctly, return the call to request() from a function with it's return type defined as a Single where ResponseModel is your response model type.
This project is licensed under the MIT License.