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.
Discover the newest tutorials on Swift and iOS development
Discover the newest tutorials on Swift and iOS development
Showing 85 to 96 of 716 posts
5:57
In the early days of the Swift language, it took just a few hours to learn the fundamentals of the language. I'm sorry to say that that is no longer true. Swift has become richer and, as a result, more complex. The language has become much more capable, but those capabilities come at a price, increased complexity.
in Concurrency
11:04
You learned in the previous episode that it is fine to ignore some of the gaps Xcode finds in your test suite. Even though the goal isn't to fill every gap, we need to write a few more unit tests for the APIClient class.
in Networking
11:05
Unit tests are very useful for testing edge cases. We explored that in the previous episode. Because bugs sometimes hide in edge cases, unit tests can help you track down hard to find bugs. This is only true if the unit tests you write are sound and cover your code.
in Networking
8:25
One of the key benefits of a robust test suite is its ability to quickly and easily test scenarios that are uncommon or hard to reproduce. In this and the next episode, we write unit tests for several scenarios that are difficult to test manually. Manual testing has value, but it is time-consuming and it can be tedious to test edge cases.
in Networking
11:55
Step by step we are increasing the code coverage of the APIClient class. In the previous episode, you learned how to use the APIs the APIClient class exposes to unit test its private methods. Remember that the goal isn't to unit test the private methods of the APIClient class. The goal is to increase the code coverage of the APIClient class. We have a few more unit tests to write.
in Networking
8:33
Code coverage is a very helpful tool to detect gaps in a test suite. In the previous episode, we enabled code coverage to learn how to write better unit tests for the APIClient class. The coverage report shows that the episodes() method is fully covered. It also reveals that the private request(:) method lacks coverage. Even though the request(:) method is private to the APIClient class, we can write unit tests to indirectly test it and increase coverage of the APIClient class. That is the focus of this episode.
in Networking
7:10
Are the unit tests we wrote for the /api/v1/episodes endpoint sufficient? How many unit tests should we write? These are some of the questions we answer in this episode. Developers often struggle with unit testing because they aren't sure when enough is enough. As a developer, you want a simple, straightforward answer. The good news is that code coverage can provide that answer.
in Networking
9:29
We can drastically improve the unit tests we wrote in the previous episodes. Even though the unit tests pass without issues, string literals and code duplication are subtle hints that we should take another look at the unit tests we wrote. At the end of this episode, we have a framework in place that we can use for the remaining unit tests of the APIClient class.
in Networking
8:42
To create a robust test suite, we need to be in control of the environment the test suite runs in. That includes being in control of the requests the application sends to the Cocoacasts API. We don't want the application to hit the Cocoacasts API when the test suite is run. In this episode, I show you how to stub the Cocoacasts API using the OHHTTPStubs library.
in Networking
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