In this session, we learn how to make network requests using the URL Session DataTask method.
We cover a simple GET request to fetch a list of posts from an endpoint, then we go further by making a POST request to create a new post.
We also learn how to convert a Data object to a swift Any object (and vice versa) using the JSONSerialization class.
Finally, we discuss some of the potential issues that may arise while using making the request including thread violation and memory leakage.
Additional Resources:
Finished Code: https://github.com/EMacco/ios-tutoria...
Link to the server: https://jsonplaceholder.typicode.com
Error Handling: • iOS Dev 18: Error Handling (Try|Do|Catch) ...
Abarian: https://abarian.ng
Concurrency: • iOS Dev 15: Concurrency Explained with Dia...
Retain Cycles: • iOS Dev 16: Retain Cycle Explained with Di...
Say Hi on Social Media:
LinkedIn: / emacco
Twitter: / its_macco