Calling APIs with URLSession
Fetch data using async/await.
What URLSession Does
URLSession is Apple framework for talking to the network. You give it a URL and it fetches the response for you. 🌐
Building a URL
Start with a valid URL. The initializer is optional because text can be malformed, so unwrap it before using.
let url = URL(string: "https://api.example.com/users")!All lessons in this course
- Decoding JSON with Codable
- Calling APIs with URLSession
- The .task Modifier
- Loading & Error States