Making burritos with Swift (or How To Mock Classes You Don’t Control)
Marin Benčević

Awesome post. Was a bit confused at the end as it didnt feel as elegant as you were prescribing. One thing we did is have an EndpointType and a URLRequestBuilder that takes EndpointType -> URLRequest. We then have a RequestPerformer that knows how to accept a request and send that on the network to return a ResultType enum that can be Success(JSON) Error(Error) if that makes sense. Then in your tests you could simply exchange your request performer with a test request performer and have it do its own mapping…

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.