← ClaudeAtlas

ios-networkinglisted

Build, review, or improve networking code in iOS/macOS apps using URLSession with async/await, structured concurrency, and modern Swift patterns. Use when working with REST APIs, downloading files, uploading data, WebSocket connections, pagination, retry logic, request middleware, caching, background transfers, or network reachability monitoring. Also use when handling HTTP requests, API clients, network error handling, or data fetching in Swift apps.
dpearson2699/swift-ios-skills · ★ 730 · Data & Documents · score 80
Install: claude install-skill dpearson2699/swift-ios-skills
# iOS Networking Modern networking patterns for iOS 26+ using URLSession with async/await and structured concurrency. All examples target Swift 6.3. No third-party dependencies required -- URLSession covers the vast majority of networking needs. ## Contents - [Core URLSession async/await](#core-urlsession-asyncawait) - [API Client Architecture](#api-client-architecture) - [Error Handling](#error-handling) - [Pagination](#pagination) - [Network Reachability](#network-reachability) - [Configuring URLSession](#configuring-urlsession) - [Common Mistakes](#common-mistakes) - [Review Checklist](#review-checklist) - [References](#references) ## Core URLSession async/await URLSession gained native async/await overloads in iOS 15. These are the only networking APIs to use in new code. Never use completion-handler variants in new projects. ### Data Requests ```swift // Basic GET let (data, response) = try await URLSession.shared.data(from: url) // With a configured URLRequest var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.httpBody = try JSONEncoder().encode(payload) request.timeoutInterval = 30 request.cachePolicy = .reloadIgnoringLocalCacheData let (data, response) = try await URLSession.shared.data(for: request) ``` ### Response Validation Always validate the HTTP status code before decoding. URLSession does not throw for 4xx/5xx responses -- it only throws for transport-level