Agent skill · software engineering · affaan-m
swift-concurrency-6-2
Swift 6.2 Approachable Concurrency — single-threaded by default, @concurrent for explicit background offloading, isolated conformances for main actor types. Use when adopting Swift 6.2 concurrency — offloading with @concurrent or resolving main-actor isolation.
Why this skill is useful
Provides specific patterns and practices for implementing Swift 6.2 concurrency features that the AI wouldn't reliably generate on its own.
What it needs
About 4k tokens when loaded. Last updated 2026-08-06. 238,342 stars on the source repository.
What this skill does
Swift 6.2 Approachable Concurrency Patterns for adopting Swift 6.2's concurrency model where code runs single-threaded by default and concurrency is introduced explicitly. Eliminates common data-race errors without sacrificing performance. When to Activate Migrating Swift 5.x or 6.0/6.1 projects to Swift 6.2 Resolving data-race safety compiler errors Designing MainActor-based app architecture Offloading CPU-intensive work to background threads Implementing protocol conformances on MainActor-isolated types Enabling Approachable Concurrency build settings in Xcode 26 Core Problem: Implicit Background Offloading In Swift 6.1 and earlier, async functions could be implicitly offloaded to background threads, causing data-race errors even in seemingly safe code: Swift 6.2 fixes this: async functions stay on the calling actor by default. Core Pattern — Isolated Conformances MainActor types can now conform to non-isolated protocols safely: The compiler ensures the conformance is only used on the main actor: Core Pattern — Global and Static Variables Protect global/static state with MainActor: MainActor Default Inference Mode Swift 6.2 introduces a mode where MainActor is inferred by default — no manual annotations needed: This mode is opt-in and recommended for apps, scripts, and other executable targets. Core Pattern — @concurrent for Background Work When you need actual parallelism, explicitly offload with @concurrent: Important: This example requires Approachable Concurrency build settings — SE-0466 (MainActor default isolation) and SE-0461 (NonisolatedNonsendingByDefault). With these enabled, extractSticker stays on the caller's actor, making mutable state access safe. Without these settings, this code has a data race — the compiler will flag it. To use @concurrent: 1. Mark the containing type as nonisolated 2. Add @concurrent to the function 3. Add async if not already asynchronous 4. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills affaan-m/swift-concurrency-6-2--42cf5d