# ios-networking

A skill that guides your coding agent through Swift networking on iOS and macOS: URLSession with async/await, error handling, retries and pagination.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 4400 installs · ★ 1237
- Author: dpearson2699
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/ios-networking/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/ios-networking

## What it does

This skill shapes how the agent writes networking code in Swift apps. It covers async/await in URLSession, a protocol-based API client, error handling, pagination, reachability checks, session configuration, App Transport Security, a list of common mistakes and a review checklist.

One point drives the rest: URLSession throws only on transport failures, never on a 4xx or 5xx reply. So the status code gets checked before decoding, and a retry is allowed only for requests that are safe, idempotent or explicitly replayable. Token refresh must not loop. Durable background transfers skip the async conveniences and go through task creation plus delegate callbacks. Large downloads stream to disk via `download(for:)` instead of filling memory.

Network policy can be validated locally with fake `URLProtocol` setup: a clean 2xx, a malformed 2xx, a single 401 refresh, bounded 429 and 5xx retries, timeout and offline cases, cancellation, and a 4xx that must not be retried. If the app needs a predictable API client with clear error classes, this is the part worth reading first.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill ios-networking -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/ios-networking/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/ios-networking/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill ios-networking -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/ios-networking/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill ios-networking -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/ios-networking/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dpearson2699/swift-ios-skills ios-networking
```

2. **Manually: put the files in place**
- File: `.github/skills/ios-networking/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill ios-networking -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/ios-networking
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/ios-networking/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill ios-networking -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/ios-networking/SKILL.md

## When to use it
- build an API client on protocols instead of raw URLSession calls
- separate transport failures from 4xx and 5xx responses
- retry idempotent requests only
- stream big downloads to disk
- wire durable transfers through delegates

## Example prompts
- Write an API client on URLSession with async/await and a dedicated error type
- Review the retry logic here so token refresh cannot loop
- Stream a response with `bytes(for:)` and parse it line by line

## Similar
- [vercel-react-native-skills](https://affpapa.org/en/nevibecode/skills/vercel-react-native-skills.md) — skill · 255200 installs
- [animate-expo](https://affpapa.org/en/nevibecode/skills/animate-expo.md) — skill · 137900 installs
- [mobile-native](https://affpapa.org/en/nevibecode/skills/mobile-native.md) — skill · 86600 installs
- [aso](https://affpapa.org/en/nevibecode/skills/aso.md) — skill · 75400 installs
- [swiftui-pro](https://affpapa.org/en/nevibecode/skills/swiftui-pro.md) — skill · 35200 installs
- [orca-emulator](https://affpapa.org/en/nevibecode/skills/orca-emulator.md) — skill · 5800 installs

From the same set: [dpearson2699/swift-ios-skills](https://affpapa.org/en/nevibecode/by/dpearson2699/swift-ios-skills.md) — 86 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
