Loading & Error States
Show spinners and handle failures gracefully.
Every Fetch Has Phases
A real request moves through states: loading, success, and failure. Showing each one makes your app feel trustworthy. 🔄
Modeling State with an Enum
An enum captures each phase cleanly. The view then switches on it to decide exactly what to display.
enum Phase { case loading, loaded([User]), failed(String) }All lessons in this course
- Decoding JSON with Codable
- Calling APIs with URLSession
- The .task Modifier
- Loading & Error States