← ClaudeAtlas

ios-networkinglisted

iOS networking expert skill covering URLSession with async/await, type-safe generic API clients, Codable JSON encoding/decoding, error handling with retry and exponential backoff, OAuth2 token management, WebSocket connections, caching strategies (URLCache/NSCache), network monitoring (NWPathMonitor), multipart uploads, certificate pinning, and GraphQL with Apollo. Use this skill whenever the user builds networking code, API clients, handles JSON, implements authentication flows, or works with remote data. Triggers on: URLSession, networking, API client, REST, HTTP, JSON, Codable, endpoint, fetch data, download, upload, WebSocket, cache, network monitor, reachability, multipart, GraphQL, Apollo, bearer token, refresh token, retry, backoff, certificate pinning, URL, request, response, async networking.
ebbaunqualified520/ios-agent-skills · ★ 0 · API & Backend · score 72
Install: claude install-skill ebbaunqualified520/ios-agent-skills
# iOS Networking Skill ## Core Rules 1. **Always use async/await** (NOT completion handlers) for new networking code. Completion handlers are legacy — Swift Concurrency is the standard since iOS 15. 2. **Build a generic APIClient** with an Endpoint protocol for type-safe requests. Never scatter raw URLSession calls throughout the codebase. 3. **Use actor-based TokenManager** for thread-safe OAuth2 token refresh with deduplication. Never allow multiple simultaneous refresh requests. 4. **Handle ALL HTTP status codes properly**: - 401 → refresh token, retry original request - 429 → respect Retry-After header, exponential backoff - 5xx → retry with exponential backoff + jitter - 4xx (other) → client error, do not retry 5. **Use URLProtocol mocking for tests** (NOT mocking URLSession itself). URLProtocol intercepts at the transport layer and tests real serialization paths. 6. **Reuse URLSession instances** — creating a session per request prevents HTTP/2 connection multiplexing and wastes memory. 7. **Use URLCache** with `.useProtocolCachePolicy` as the default cache policy. Configure cache size explicitly for production apps. 8. **NWPathMonitor for connectivity awareness**, NOT pre-flight checks. Never gate a request on reachability — just make the request and handle the error. 9. **Codable with `.convertFromSnakeCase`** and custom date strategies. Avoid manual CodingKeys when snake_case conversion handles it. 10. **Keep ATS enabled.** Use domain-specific exception