Episode #471

Faking an API Server with URLProtocols

19 minutes
Published on January 7, 2021

This video is only available to subscribers. Get access to this video and 572 others.

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.

This episode uses Swift 5.3, Xcode 12.3.