filmov
tv
SwiftUI Tutorial: How to make a API call, fetch JSON, and structure you networking layer with MVVM
Показать описание
In this tutorial, we are going to fetch JSON data from an API and show it in a list view in SwiftUI. I will discuss how I structure my code base with MVVM (Model - View Model - View). Also I am including an extra layer for the networking logic because it helps make my code more reusable and write unit tests. You will also learn about error handling with URLSession and how to show error information to the user.
😻 The example API is the cat API.
Overview
00:00 Introduction
02:52 project organisation with MVVM
15:05 error handling, custom error type
19:03 Separate networking layer and error handling
28:44 loading view
29:48 error view
33:08 breed list views with AsyncImage
41:18 searchable view modifier to search by breed name
43:11 cat breed detail view
47:11 unit tests, mock service and dependency injection
54:29 Wrap up
🤩 Learn more
If you liked what you learned and you want to see more, check out one of my courses!
👩🏻💻 Combine course
#SwiftUI #networking #JSONParsing #API
😻 The example API is the cat API.
Overview
00:00 Introduction
02:52 project organisation with MVVM
15:05 error handling, custom error type
19:03 Separate networking layer and error handling
28:44 loading view
29:48 error view
33:08 breed list views with AsyncImage
41:18 searchable view modifier to search by breed name
43:11 cat breed detail view
47:11 unit tests, mock service and dependency injection
54:29 Wrap up
🤩 Learn more
If you liked what you learned and you want to see more, check out one of my courses!
👩🏻💻 Combine course
#SwiftUI #networking #JSONParsing #API
Комментарии