swift-concurrency-6-2

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

2|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/adamreger/ecc-antigravity --skill swift-concurrency-6-2-adamreger
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: swift-concurrency-6-2
Source: https://github.com/adamreger/ecc-antigravity/tree/main/skills/swift-concurrency-6-2
Command: npx skills add https://github.com/adamreger/ecc-antigravity --skill swift-concurrency-6-2-adamreger

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: Covers the @concurrent attribute for moving CPU-intensive work like image processing to background threads. - 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 AI to migrate my Swift class to Swift 6.2 approachable concurrency and fix the data-race errors in my MainActor view model.

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 once you enable approachable concurrency build settings. For remaining issues, annotate shared state with @MainActor or use isolated conformances instead of nonisolated workarounds.

What is the @concurrent attribute in Swift 6.2?▼

@concurrent explicitly offloads a function to the background thread pool for CPU-intensive work like image processing. Mark the containing type nonisolated, add @concurrent and async to the function, and use await at call sites.

Does Swift 6.2 require annotating every class with @MainActor?▼

No. Swift 6.2 offers an opt-in MainActor default inference mode where types, properties, and conformances are implicitly @MainActor without manual annotations. This mode is recommended for apps, scripts, and other executable targets.

Can MainActor types conform to non-isolated protocols in Swift 6.2?▼

Yes, using isolated conformances such as extension StickerModel: @MainActor Exportable. The compiler ensures the conformance is only used on the main actor, rejecting it in nonisolated contexts at compile time.

When should I avoid using @concurrent in Swift code?▼

Avoid applying @concurrent to every async function, since most code does not need background execution. Profile with Instruments first and offload only CPU-intensive hot paths like image processing, compression, or complex computation.