swift-concurrency-6-2

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

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill swift-concurrency-6-2-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: swift-concurrency-6-2
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/swift-concurrency-6-2
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill swift-concurrency-6-2-freedom909

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 the patterns to adopt 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 Error Resolution: Fix "Sending risks causing data races" errors by keeping async functions on the calling actor instead of implicit background offloading. - Isolated Conformances: Implement protocol conformances on MainActor-isolated types safely using @MainActor conformance syntax. - Explicit Background Offloading: Use @concurrent on nonisolated types to move CPU-intensive work like image processing to the concurrent thread pool. - Use Case: When migrating an app to Xcode 26, enable MainActor default inference so view models and global singletons like StickerLibrary.shared become implicitly MainActor-isolated without manual annotations, then offload only hot paths with @concurrent. ## Quick Start Ask the AI to migrate my Swift class to Swift 6.2 concurrency and fix the data-race errors in my async image processing 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, eliminating implicit background offloading that caused data races. Enable Approachable Concurrency build settings in Xcode 26, then annotate remaining shared mutable state with @MainActor.

How to run Swift code on a background thread in Swift 6.2?▼

Mark the containing type as nonisolated, add the @concurrent attribute to the function, ensure it is async, and use await at call sites. This explicitly offloads CPU-intensive work like image processing to the concurrent thread pool.

What is an isolated conformance in Swift 6.2?▼

An isolated conformance lets a MainActor-isolated type conform to a non-isolated protocol using `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 require @MainActor on every class?▼

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

When should I not use @concurrent in Swift?▼

Avoid applying @concurrent to every async function, since most do not need background execution. Use it only for CPU-intensive work like image processing or compression, and profile with Instruments first to find actual bottlenecks.