guide-swift-concurrency

Guide Swift 6.2+ concurrency implementation and review for correctness.

Updated May 6, 2026
One-click install
npx skills add https://github.com/Roy-wonji/claude-config --skill guide-swift-concurrency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guide-swift-concurrency
Source: https://github.com/Roy-wonji/claude-config/tree/main/skills/apple-skills/skills/guide-swift-concurrency
Command: npx skills add https://github.com/Roy-wonji/claude-config --skill guide-swift-concurrency

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This guide prevents subtle Swift concurrency bugs by teaching correct patterns for actors, structured concurrency, cancellation, async streams, and safe migration away from GCD.

Core Features & Use Cases

  • Actor-correctness review: Detects and fixes reentrancy issues after suspension points and unsafe state assumptions.
  • Structured concurrency guidance: Recommends task groups and async let over unstructured Task usage, especially inside loops.
  • Cancellation, streams, and bridging: Covers cooperative cancellation, AsyncStream continuation lifecycle, and checked continuation rules to avoid hangs or double-resume crashes.
  • Strict concurrency diagnostics mapping: Interprets Swift 6.2 strict-concurrency compiler errors and links them to likely fixes.

Quick Start

Use this guide to review or generate Swift 6.2+ concurrent code by checking actors, structured tasks, cancellation handling, AsyncStream usage, bridging correctness, and strict-concurrency diagnostics.

Frequently Asked Questions about guide-swift-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix Swift concurrency actor reentrancy issues after suspension points?

Fix Swift actor reentrancy by reviewing state assumptions after suspension points and ensuring safe state access within actor isolation boundaries. This guide detects unsafe state assumptions and recommends correct actor isolation patterns to eliminate reentrancy bugs.

What is the best way to use structured concurrency instead of unstructured Task in Swift loops?

The best way to use structured concurrency in Swift is replacing unstructured Task calls inside loops with task groups or async let. This ensures proper task composition, cancellation propagation, and structured error handling across concurrent operations.

How do I handle cooperative cancellation in Swift async streams and checked continuations?

Handle cooperative cancellation in Swift by checking cancellation status within async streams and following checked continuation lifecycle rules. This prevents double-resume crashes and task hangs caused by improper AsyncStream continuation handling.

How do I map Swift 6.2 strict concurrency diagnostics to fixes?

Map Swift 6.2 strict concurrency diagnostics to fixes by interpreting compiler errors and linking them to likely solutions for actor isolation, structured concurrency, and bridging. This guide translates strict-concurrency warnings into actionable code corrections.

How do I migrate GCD code to Swift structured concurrency safely?

Migrate GCD to Swift structured concurrency by replacing dispatch queues with task groups, async let, and actors. This guide covers safe migration patterns that eliminate data races while preserving existing concurrent execution behavior.

Why does my AsyncStream continuation cause a double-resume crash in Swift?

AsyncStream continuation double-resume crashes occur when continuation lifecycle rules are violated, causing multiple resume calls on a single continuation. This guide provides safe AsyncStream and checked continuation handling patterns to prevent these crashes.