Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
johnrogers avatar

Swift Networking

  • 143 installs
  • 222 repo stars
  • Updated January 18, 2026
  • johnrogers/claude-swift-engineering

Build robust URLSession clients, async HTTP calls, decoding, auth headers, retries, and API error handling in Swift mobile apps.

About

Covers Swift networking best practices including URLSession, async-await, request and response modeling, authentication headers, retries, decoding, and production-ready API client patterns for Apple platforms.

  • URLSession
  • Async networking
  • REST clients
  • Error handling
  • Swift concurrency

Swift Networking by the numbers

  • 143 all-time installs (skills.sh)
  • +2 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #532 of 1,039 Mobile Development skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/johnrogers/claude-swift-engineering --skill swift-networking

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs143
repo stars222
Last updatedJanuary 18, 2026
Repositoryjohnrogers/claude-swift-engineering

What it does

Build robust URLSession clients, async HTTP calls, decoding, auth headers, retries, and API error handling in Swift mobile apps.

Files

SKILL.mdMarkdownGitHub ↗

Swift Networking

Network.framework is Apple's modern networking API for TCP/UDP connections, replacing BSD sockets with smart connection establishment, user-space networking, and seamless mobility handling.

Reference Loading Guide

ALWAYS load reference files if there is even a small chance the content may be required. It's better to have the context than to miss a pattern or make a mistake.

ReferenceLoad When
[Getting Started](references/getting-started.md)Setting up NWConnection for TCP/UDP, choosing between APIs
[Connection States](references/connection-states.md)Handling .waiting, .ready, .failed transitions
[iOS 26+ Networking](references/ios26-networking.md)Using NetworkConnection with async/await, TLV framing, Coder protocol
[Migration Guide](references/migration.md)Moving from sockets, CFSocket, SCNetworkReachability, URLSession
[Troubleshooting](references/troubleshooting.md)Debugging timeouts, TLS failures, connection issues

Core Workflow

1. Choose transport (TCP/UDP/QUIC) based on use case 2. Create NWConnection (iOS 12+) or NetworkConnection (iOS 26+) 3. Set up state handler for connection lifecycle 4. Start connection on appropriate queue 5. Send/receive data with proper error handling 6. Handle network transitions (WiFi to cellular)

When to Use Network.framework vs URLSession

  • URLSession: HTTP, HTTPS, WebSocket, simple TCP/TLS streams
  • Network.framework: UDP, custom protocols, low-level control, peer-to-peer, gaming

Common Mistakes

1. Ignoring state handlers — Creating an NWConnection without a state change handler means you never learn when it's ready or failed. Always implement the state handler first.

2. Blocking the main thread — Never call receive() on the main queue. Use a background DispatchQueue or Task for all network operations.

3. Wrong queue selection — Using the wrong queue (UI queue for network work, or serial queue for concurrent reads) causes deadlocks or silent failures. Always explicit your queue choice.

4. Not handling network transitions — WiFi/cellular switches or network loss aren't always detected automatically. Implement viability checks and state monitoring for robust apps.

5. Improper error recovery — Network errors need retry logic with backoff. Immediately failing on transient errors (timeouts, temporary loss) creates poor UX.

Related skills

Mobile Developmentbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.