Smithery Logo
MCPsSkillsDocsPricing
Login
NewFlame, an assistant that learns and improves. Available onTelegramSlack
    goodevibes

    swift-networking

    goodevibes/swift-networking
    Coding

    About

    SKILL.md

    Install

    • Telegram
      Telegram
    • Slack
      Slack
    • Claude Code
      Claude Code
    • Codex
      Codex
    • OpenClaw
      OpenClaw
    • Cursor
      Cursor
    • Amp
      Amp
    • GitHub Copilot
      GitHub Copilot
    • Gemini CLI
      Gemini CLI
    • Kilo Code
      Kilo Code
    • Junie
      Junie
    • Replit
      Replit
    • Windsurf
      Windsurf
    • Cline
      Cline
    • Continue
      Continue
    • OpenCode
      OpenCode
    • OpenHands
      OpenHands
    • Roo Code
      Roo Code
    • Augment
      Augment
    • Goose
      Goose
    • Trae
      Trae
    • Zencoder
      Zencoder
    • Antigravity
      Antigravity
    • Download skill
    ├─
    ├─
    └─
    Smithery Logo

    Give agents more agency

    Resources

    DocumentationPrivacy PolicySystem Status

    Company

    PricingAboutBlog

    Connect

    © 2026 Smithery. All rights reserved.

    About

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

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

    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.

    Recommended Servers
    Blockscout MCP Server
    Blockscout MCP Server
    ThinAir Data
    ThinAir Data
    Exa Search
    Exa Search
    Repository
    goodevibes/swiftagent
    Files