Minimal example app to demo a the techniques below.
Inspired by Pointfree's course on Designing Dependencies I've decided to move away from a protocol-oriented approach for dependencies, and exposed a simple struct instead.
- separating interface and implementation can help a lot with build times in larger projects
- the approach results in less boilerplate, and provides straightforward inline mocking
This approach is based on Moya's implementation.
- enums are a good way to represent a finite number of endpoints
- the requirements of declaring a remote API are made clear via protocols.
Instead of wrapping Foundation components in protocols, I've decided to rely on URLProtocol
to provide mock responses (based on this article)