In this and the next episodes, we add the ability for the user to watch an episode. For that to work, the application needs to fetch the video for the episode from the mock API. Fetching a video is similar to fetching the list of episodes. The difference is that the user needs to be signed in to fetch a video because a video is a protected resource. The request to the /videos/:id
endpoint needs to include an Authorization
header. The value of the Authorization
header is the access token the application receives after successfully signing in.
Subscribe to Cocoacasts Plus to watch this episode.
Building a Modern Networking Layer in Swift
Working with Protected Resources
by Bart Jacobs in Networking
Swift 5
Xcode 13
iOS 15
Building a Modern Networking Layer in Swift
-
06:30
-
08:01
-
09:24
-
09:27
-
5 Making the API Client Extensible
08:04
-
10:07
-
08:16
-
8 Working with Protected Resources
10:07
-
09:55
-
09:49
-
12 Creating and Updating Video Progress
06:40
-
07:57
-
14 Unit Testing the Networking Layer
10:32
-
15 Unit Testing Asynchronous Code
07:45
-
16 Stubbing the Cocoacasts API
08:42
-
18 Enabling Code Coverage to Find Gaps
07:10
-
20 Writing the Wrong Unit Tests
11:55
-
21 Writing Unit Tests for Edge Cases
08:25
-
22 Catching Bugs with Unit Tests
11:05
-
11:04