swift-networking
Skill0 starsChanged 2 months agoMITView on GitHub
Use when implementing Network.framework connections (NWConnection, NetworkConnection), debugging connection failures, migrating from sockets/URLSession streams, or handling network transitions. Covers UDP/TCP patterns, structured concurrency networking (iOS 26+), and common anti-patterns.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- pluginagentmarketplace/custom-plugin-swifttheir own version, first seen Dec 30, 2025
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- pluginagentmarketplace/custom-plugin-swift★ 9same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository21 other files it gives its agents.
- animateSkill
- composable-architectureSkill
- find-animation-opportunitiesSkill
- generating-swift-package-docsSkill
- hapticsSkill
- improve-animationsSkill
- ios-26-platformSkill
- ios-higSkill
- ios-simulator-skillSkill
- localizationSkill
- review-animationsSkill
- spm-build-analysisSkill
- storekitSkill
- swift-concurrencySkill
- swift-dataSkill
- swift-diagnosticsSkill
- swift-styleSkill
- swift-testingSkill
- swiftuiSkill
- write-swiftSkill
- xcode-buildSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Create NWConnection (iOS 12+) or NetworkConnection (iOS 26+)
- Distinctive: line 27
Start connection on appropriate queue
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.
| Reference | Load When |
| Getting Started | Setting up NWConnection for TCP/UDP, choosing between APIs |
| Connection States | Handling .waiting, .ready, .failed transitions |
| iOS 26+ Networking | Using NetworkConnection with async/await, TLV framing, Coder protocol |
| Migration Guide | Moving from sockets, CFSocket, SCNetworkReachability, URLSession |
| Troubleshooting | Debugging timeouts, TLS failures, connection issues |
Core Workflow
- Choose transport (TCP/UDP/QUIC) based on use case
- Create NWConnection (iOS 12+) or NetworkConnection (iOS 26+)
- Set up state handler for connection lifecycle
- Start connection on appropriate queue
- Send/receive data with proper error handling
- 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
- 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.
- Blocking the main thread — Never call
receive()on the main queue. Use a background DispatchQueue or Task for all network operations. - 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.
- Not handling network transitions — WiFi/cellular switches or network loss aren't always detected automatically. Implement viability checks and state monitoring for robust apps.
- Improper error recovery — Network errors need retry logic with backoff. Immediately failing on transient errors (timeouts, temporary loss) creates poor UX.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

