A solid reference for URLSession patterns in modern Swift. Covers the async/await APIs introduced in iOS 15, structured concurrency, and protocol-based client architecture with middleware support. The guide includes practical patterns for token refresh, pagination, streaming with AsyncBytes, and error mapping from URLError cases. It's opinionated in the right ways: status code validation (since URLSession doesn't throw on 4xx/5xx), always using download for large files to avoid memory issues, and avoiding completion handlers entirely in new code. The structured error types and endpoint modeling are clean. Use this when you're building or reviewing API clients and want to stick with first-party frameworks instead of reaching for Alamofire.

skills.sh installs
4.6K
GitHub stars
1.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add dpearson2699/swift-ios-skills --skill ios-networking --agent claude-code

Installs into .claude/skills of the current project.

Files

iOS Networking

Use URLSession with async/await and structured concurrency for ordinary HTTP, REST, uploads, downloads, and streaming. Use Network.framework for lower-level protocols and delegate/task APIs for durable background transfers.

Contents

Core URLSession async/await

URLSession gained native async/await overloads in iOS 15. Prefer these for foreground data, upload, download, and streaming work. Background URLSession transfers are the main exception: they still use task/delegate APIs so the system can deliver events after suspension or relaunch.

Sponsors

Details

Repository
github.com/dpearson2699/swift-ios-skills
Categories
Backend & APIs, DevOps & CI/CD, Git & Pull Requests, Code Review & Quality, Debugging, Mobile Development
First seen
Apr 16, 2026

More from dpearson2699/swift-ios-skills

All 98
1unnoo avatarzsxq-sharedunnoo/zsxq-skill知识星球 CLI 共享基础:认证登录(auth login/logout/status)、配置诊断(doctor/config show)、通用 API 调用规范(api list/api call/api raw 调用底层接口或原始 HTTP 接口)、星球与主题分享链接拼接(电脑端 / 手机端)、写入与删除操作的安全4.6Kskills.sh installs
2grafana avatartestinggrafana/skillsProbe, load-test, and instrument frontends from Grafana Cloud. Covers Synthetic Monitoring (HTTP / DNS / TCP / Ping / Traceroute / Multihttp / k6-browser script4.5Kskills.sh installs
3jeffallan avatardjango-expertjeffallan/claude-skillsUse when building Django web applications or REST APIs with Django REST Framework. Invoke when working with settings.py, models.py, manage.py, or any Django pro4.5Kskills.sh installs
4grafana avataradmingrafana/skillsManage Grafana Cloud accounts — organizations, stacks, RBAC roles and assignments, SSO/SAML/OAuth/GitHub auth, service accounts for CI/CD, user invites, team me4.4Kskills.sh installs
5giuseppe-trisciuoglio avatarnestjsgiuseppe-trisciuoglio/developer-kitProvides comprehensive NestJS framework patterns with Drizzle ORM integration for building scalable server-side applications. Generates REST/GraphQL APIs, imple4.4Kskills.sh installs
6agricidaniel avatarads-auditagricidaniel/claude-adsRun a source-grounded paid-advertising audit for one or more of Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, Apple, Amazon, Reddit, Pinterest, Snapchat, 4.3Kskills.sh installs