Networking
Intermediate 3 min read
URLSession async/await
Modern networking without callbacks or Combine
iOS Academy
iOS Engineer
`URLSession.data(from:)` suspends the current task and resumes when data arrives, replacing delegate callbacks and completion handlers entirely. Always validate the HTTP status code before decoding — a 404 body is still valid Data but contains an error payload. Wrap the call in a `Task {}` when bridging from synchronous contexts like `viewDidLoad`.
#networking
#async/await
#URLSession