smithery/goodevibes

swift-networking

Use when implementing Network.framework connections (NWConnection, NetworkConnection), debugging connection failures, migrating from sockets/URLSession streams, or handling network transitions.

Installation

$ npx skills add smithery/goodevibes --skill swift-networking

Summary

  • 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.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/goodevibes.

npx skills add smithery/goodevibes

Browse all from smithery/goodevibes

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,629 B
  • docs SUMMARY.md 313 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

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.

Quick Reference

Reference Load 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.
  1. Blocking the main thread — Never call receive() on the main queue. Use a background DispatchQueue or Task for all network operations.
  1. 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.
  1. Not handling network transitions — WiFi/cellular switches or network loss aren't always detected automatically. Implement viability checks and state monitoring for robust apps.
  1. Improper error recovery — Network errors need retry logic with backoff. Immediately failing on transient errors (timeouts, temporary loss) creates poor UX.