Learn Swift and iOS Development
Master iOS development through in-depth tutorials and comprehensive courses on Swift, SwiftUI, UIKit, Core Data, and more.
Master iOS development through in-depth tutorials and comprehensive courses on Swift, SwiftUI, UIKit, Core Data, and more.
Learn Swift and iOS development through comprehensive video guides
Showing 85 to 96 of 420 posts
7:45
Even though the unit test we wrote in the previous episode passes, we quickly discovered that it gives us a false sense of confidence. The unit test passes because it is executed synchronously. To unit test the networking layer, we need to replace the synchronous unit test with an asynchronous unit test. Let me show you how that works.
in Networking
10:32
The networking layer we are building is nearing completion. We added support for most endpoints of the Cocoacasts API and, later in this series, we add support for refreshing an access token using a refresh token. In the next few episodes, we focus on unit testing the networking layer.
in Networking
6:49
A build configuration defines the build settings that are used to build the product of a target. As the name suggests, build settings are used to build the product of a target. Even though you don't commonly access build settings in Swift, it can be useful to keep configuration and implementation separate. It is a pattern I have been using for several years. In this episode, I show you how to access build settings in Swift.
in Foundation
6:50
The Swift Package Manager has come a long way and support for Xcode improves with every release of Apple's IDE. Even though there are several third party solutions for managing the dependencies of a project, CocoaPods and Carthage being the most popular, the Swift Package Manager has become a viable option in recent years. In this episode, I show you how to add a Swift package to a project in Xcode.
in Xcode
7:57
In the previous episodes, we added support for fetching, creating, and updating video progress. In this episode, you learn how to delete the progress for a video, the D in CRUD. Deleting the progress for a video is a bit special because the body of the response is empty. Let me show you what changes we need to make to add support for deleting the progress for a video.
in Networking
6:40
In the previous episode, you learned about CRUD operations and we applied this to video progress. We added the ability to fetch the progress for a video, the R in CRUD. In this episode, we cover creating and updating video progress, the C and U in CRUD.
in Networking
9:49
At this point, you should have a good understanding of the networking layer we are building. Even though we have written quite a bit of code, the networking layer we built isn't complex. We simply combined a number of common patterns and techniques to create a solution that is easy to use and extend. Later in this series, I show you that it is also easy to test.
in Networking
7:52
The video view model is no longer required to pass an access token to the API client if it requests the video of an episode. That is a welcome improvement. The API client passes an access token to an APIEndpoint object and it is the APIEndpoint object that decides when it is appropriate to add an Authorization header to a request. The changes we made in the previous episode improved the networking layer we are building.
in Networking
9:55
In the previous episode, we extended the API client with the ability to fetch the video for an episode. Because videos are protected resources, the request includes an Authorization header with an access token as its value. The solution we implemented works, but it is tedious to pass the access token to the API client and the object invoking the video(id:accessToken:) method shouldn't need to deal with access tokens. That is a responsibility of the API client.
in Networking
10:07
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.
in Networking
8:16
Earlier in this series, we declared the computed message property in the APIError enum. While that seemed like a good idea at that time, the previous episode showed that we need a solution that is more flexible. The APIError enum doesn't have the context it needs to define a human-readable message for each of its cases.
in Networking
10:07
The user needs to be signed in to watch a video so the next feature we implement is the ability for the user to sign in with their email and password. This episode illustrates how a proper foundation can save time and reduce complexity. The improvements we made in the previous episode simplify the changes we need to make in this and the next episodes.
in Networking