SwiftUI Data & ArchitectureLesson 53Free preview
Networking
This lesson is part of Swift · All levels
Summary
This lesson reviews the networking techniques in Swift using the URLSession and the Decodable protocol. Developers are taught how to send HTTP GET requests using the modern async/await syntax, validate HTTP status code, and perform instantaneous JSON data parsing to Swift struct.
Key points
- URLSession is the Foundation's built-in API for handling HTTP/HTTPS requests
- The 'URLSession.shared.data(from: url)' method is integrated with Swift Concurrency async/await
- The 'Codable' protocol automatically serializes and deserializes the JSON format data
- JSONDecoder maps the JSON response data to Swift struct models securely
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.