In this video, we connect the user interface for the home page with our backend.
We start by implementing the request function in the Network Service, then make the call when the app is first launched.
We also install a dependency called ProgressHUD to help us represent a loading state for when the request is processing.
Finally, do some debugging to fix an issue where category names were not showing up.
Having issues installing ProgressHUD? Use this commit version instead.
Note: Replace ")" with a "greater than" sign
pod 'ProgressHUD', :git =) 'https://github.com/relatedcode/Progre..., :commit =) '83c3801e9aa69be157a47c40cdd8702bfaf29213'
API Documentation:
1. Fetch all Categories: GET /dish-categories
Response Type: AllDishes
Struct AllDishes: Decodable {
let categories: [DishCategory]?
let populars: [Dish]?
let specials: [Dish]?
}
2. Place Order: POST /orders/:dishId
parameters: [ "name": String ]
Response Type: [Order]
3. Fetch Dishes by Category: GET /dishes/:categoryId
Response Type: [Dish]
4. Fetch Orders: GET /orders
Response Type: [Order]
Additional Resources:
Complete Yummie UI: https://github.com/EMacco/ios-tutoria...
Yummie Full App: https://github.com/EMacco/ios-tutoria...
Introduction to Networking: • iOS Dev 23: Introduction to Networking | i...
URL Session DataTask: • iOS Dev 24: Networking with URL Session Da...
Encodable & Decodable: • iOS Dev 26: Encodable & Decodable | Swift ...
Generics: • iOS Dev 14: Generics for Code Reusability ...
Structs & Enums: • Introduction to Swift 7 - Structs & Enums
Retain Cycle: • iOS Dev 16: Retain Cycle Explained with Di...
Concurrency: • iOS Dev 15: Concurrency Explained with Dia...
Say Hi on Social Media:
LinkedIn: /
Twitter: / its_macco
Video Content
1. Introduction 00:00
2. Implement Endpoint Route 00:45
3. Implement request function 02:49
4. Fetch categories on app load 07:17
5. Install ProgressHUD 09:19
6. Update UI with data from API 11:52
7. App Launch and Debugging 13:50
8. Conclusion 21:49