In the previous episode, we made the Core Location framework a dependency of the project. That is fine, but we don't want a dependency to compromise the testability of the project. In this episode, we use a proven and familiar pattern to improve the testability of the GeocodingClient
class.
Subscribe to Cocoacasts Plus to watch this episode.
Mastering MVVM with SwiftUI
Improving the Testability of the Geocoding Client
by Bart Jacobs in Model-View-ViewModel
Swift 5
Xcode 14
iOS 16
Mastering MVVM with SwiftUI
-
1 Views, Models, and View Models
03:37
-
04:49
-
07:05
-
07:51
-
06:12
-
05:50
-
06:33
-
8 Populating the Locations View
10:17
-
08:17
-
10 Populating the Location View
08:22
-
10:08
-
14 Populating the Add Location View
07:51
-
15 Integrating the Geocoding Service
11:29
-
17 Improving the Testability of the Geocoding Client
03:55
-
18 Optimizing the User Experience
08:44
-
19 Refactoring the Add Location View
05:09
-
21 Updating Locations in User Defaults
08:24
-
08:18
-
23 Defining the Weather Data Model
09:22
-
05:33
-
25 Injecting Base URL and API Key
07:50
-
09:03
-
29 Refactoring the Forecast View Model
04:49
-
30 Refactoring the Location View Model
05:27
-
05:47
-
33 Injecting Dependencies with Swinject
07:03
-
34 Unit Testing a Simple View Model
09:49
-
35 Unit Testing a Complex View Model
09:12
-
36 Writing Asynchronous Unit Tests
08:10