
This video is only available to subscribers. Start a subscription today to get access to this and 484 other videos.
Faking an API Server with URLProtocols
Episode
#471
|
19 minutes
| published on
January 7, 2021
| Uses Xcode-12.3, Swift-5.3
Subscribers Only
Imagine you're building an app that will consume an API, however the API is not ready yet. The server team has given you some sample responses as JSON files you can use to start working against. In this episode we'll examine a useful technique of registering a custom URLProtocol for intercepting and handling network requests. We can use this fake server to continue building out our network infrastructure without being dependent on the backend API.
Episode Links
- URLProtocol documentation
- OHHTTPStubs -
- Episode 335 - Stubbing Network Requests - I covered using OHHTTPStubs in Episode 335 where we stub network requests for our tests