swift-concurrency-6-2

Migrate Swift code to Swift 6.2 approachable concurrency with MainActor defaults and @concurrent offloading.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill swift-concurrency-6-2-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-concurrency-6-2
Source: https://github.com/ibytechaos/claude/tree/main/plugins/everything-claude-code/skills/swift-concurrency-6-2
Command: npx skills add https://github.com/ibytechaos/claude --skill swift-concurrency-6-2-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Swift 6.1 and earlier implicitly offload async functions to background threads, causing data-race compiler errors even in seemingly safe code. This Skill provides patterns for adopting Swift 6.2's approachable concurrency model, where code stays single-threaded by default and concurrency is introduced explicitly. ## Core Features & Use Cases - Data-Race Elimination: Explains how Swift 6.2 keeps async functions on the calling actor, removing implicit offloading errors. - Isolated Conformances: Shows how MainActor types can conform to non-isolated protocols safely using @MainActor conformances. - Explicit Background Offloading: Guides use of @concurrent on nonisolated types for CPU-intensive work like image processing. - Use Case: When migrating an app to Xcode 26 and hitting "Sending 'self' risks causing data races" errors, apply these patterns to enable MainActor default inference and resolve compiler errors incrementally. ## Quick Start Ask the assistant to migrate my Swift class to Swift 6.2 approachable concurrency and fix the data-race errors in my MainActor code.

Frequently Asked Questions about swift-concurrency-6-2

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

FAQPage Schema
How do I fix data-race errors when migrating to Swift 6.2?

Swift 6.2 keeps async functions on the calling actor by default, so most implicit offloading data races disappear. Enable the Approachable Concurrency build settings in Xcode's Swift Compiler Concurrency section, then annotate remaining shared state with @MainActor.

How to offload CPU-intensive work to background threads in Swift 6.2?

Mark the containing type as nonisolated, add @concurrent to the function, ensure it is async, and use await at call sites. Use this only for expensive work like image processing or compression after profiling with Instruments.

What is an isolated conformance in Swift 6.2?

An isolated conformance lets a MainActor type conform to a non-isolated protocol by writing `extension MyType: @MainActor MyProtocol`. The compiler guarantees the conformance is only used on the main actor, rejecting use from nonisolated contexts.

Does Swift 6.2 run async code on background threads by default?

No. Swift 6.2 keeps async functions on the calling actor by default, unlike Swift 6.1 which could implicitly offload them. Background execution requires explicit opt-in via the @concurrent attribute.

When should I enable MainActor default inference mode?

Enable it for apps, scripts, and other executable targets that are mostly single-threaded. It implicitly applies @MainActor to types, properties, and conformances, removing boilerplate annotations while keeping code data-race safe.