$npx skillfedfor your agent

swift-concurrency-6-2

This skill guides you through Swift 6.2's concurrency paradigm, where code runs single-threaded by default and background work requires explicit @concurrent annotation. Learn how async functions now stay on the caller's actor, eliminating implicit thread offloading that caused data races in earlier versions. Master isolated protocol conformances for MainActor types and adopt MainActor inference to reduce boilerplate in app targets.

Swift Concurrency 6.2 helps you migrate projects safely by making async stay on the caller's actor and requiring explicit @concurrent for background work.

AI-generated summary based on this skill's SKILL.md

1,767 298 MITupdated by xu-xiang

Decision gist · record as of 2026-03-05

Swift Concurrency 6.2 helps you migrate projects safely by making async stay on the caller's actor and requiring explicit @concurrent for background work. This skill guides you through Swift 6.2's concurrency paradigm, where code runs single-threaded by default and background work requires explicit @concurrent annotation. Learn how async functions now stay on the caller's actor, eliminating implicit thread offloading that caused data races in earlier versions. Master isolated protocol conformances for MainActor types and adopt MainActor inference to reduce boilerplate in app targets.

manual: git clone https://github.com/xu-xiang/everything-claude-code-zh → cp -r everything-claude-code-zh/skills/swift-concurrency-6-2 ~/.claude/skills/swift-concurrency-6-2
skills/swift-concurrency-6-2/SKILL.md · version d6258137

Use it when

  • swift-concurrency-6-2 guides migration by teaching the core shift: async functions no longer implicitly offload to background threads.
  • swift-concurrency-6-2 explains that MainActor isolation ensures code runs on the main thread.

Verify before relying

Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

xu-xiang/everything-claude-code-zh/swift-concurrency-6-2 · repository language: JavaScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

Is Swift 6.2 concurrency approachable for developers new to async?

swift-concurrency-6-2 makes concurrency approachable by defaulting to single-threaded execution—code runs on the caller's actor unless you explicitly mark work with @concurrent. This eliminates the implicit thread-hopping that caused data races in earlier Swift versions. You learn predictable patterns: async functions stay on their actor, MainActor inference reduces boilerplate in app targets, and isolated protocol conformances clarify which thread each method runs on.

How do I migrate Swift 5 to 6.2 concurrency?

swift-concurrency-6-2 guides migration by teaching the core shift: async functions no longer implicitly offload to background threads. Instead, they inherit the caller's actor context. To move CPU-intensive work off the main thread, use explicit @concurrent annotation. Resolve compiler data-race errors by adopting Sendable constraints, protecting global static variables, and applying MainActor isolation to UI types. The skill covers isolated protocol conformances so your types conform safely on the main thread.

What is MainActor isolation and how does protocol conformance work?

swift-concurrency-6-2 explains that MainActor isolation ensures code runs on the main thread. With isolated conformances, you declare that a type's protocol methods execute on MainActor without annotating each method individually. MainActor inference in app targets automatically applies this isolation to UI types, reducing boilerplate. This pattern prevents data races by guaranteeing thread safety for UI updates and main-thread-only operations.

How do I use @concurrent for background work in Swift 6.2?

swift-concurrency-6-2 teaches explicit @concurrent offloading: mark CPU-intensive functions with @concurrent to run them off the caller's actor on a background thread. This replaces the implicit thread-hopping of earlier versions. The skill covers when and how to apply @concurrent, ensuring your async functions stay on their actor by default while giving you precise control over which work runs in the background, eliminating data races.

How does Swift 6.2 eliminate data races with single-threaded-by-default?

swift-concurrency-6-2 shows how single-threaded-by-default architecture prevents data races: code runs on one actor unless explicitly offloaded. Async functions inherit the caller's actor instead of jumping threads unpredictably. Sendable constraints and MainActor isolation enforce thread-safe data sharing. The compiler catches data-race errors at build time. This model replaces the implicit concurrency of earlier Swift versions, making thread safety the default rather than an afterthought.

What compiler errors will I encounter when adopting Swift 6.2?

swift-concurrency-6-2 helps resolve common data-race errors: non-Sendable types crossing actor boundaries, unprotected global static variables, and missing MainActor annotations on UI code. The skill teaches how to apply Sendable conformances, use isolated properties, and adopt MainActor inference in app targets. Understanding these errors—and the patterns to fix them—is central to migrating existing projects and writing new code that compiles without data-race warnings.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Swift 6.2 易用的并发 (Approachable Concurrency)

采用 Swift 6.2 并发模型的模式:代码默认在单线程运行,并发需显式引入。在不牺牲性能的情况下消除常见的数据竞争(Data-race)错误。

何时激活

  • 将 Swift 5.x 或 6.0/6.1 项目迁移到 Swift 6.2
  • 解决数据竞争安全的编译器错误
  • 设计基于 MainActor 的应用架构
  • 将 CPU 密集型工作卸载到后台线程
  • MainActor 隔离的类型上实现协议一致性(Protocol conformances)
  • 在 Xcode 26 中启用易用的并发(Approachable Concurrency)构建设置

核心问题:隐式后台卸载

在 Swift 6.1 及更早版本中,异步函数(Async functions)可能会被隐式卸载到后台线程,即使在看似安全的代码中也会导致数据竞争错误:

// Swift 6.1: 错误 (ERROR)
@MainActor
final class StickerModel {
    let photoProcessor = PhotoProcessor()

    func extractSticker(_ item: PhotosPickerItem) async throws -> Sticker? {
        guard let data = try await item.loadTransferable(type: Data.self) else { return nil }

        // 错误:发送 'self.photoProcessor' 存在引起数据竞争的风险
        return await photoProcessor.extractSticker(data: data, with: item.itemIdentifier)
    }
}

Swift 6.2 修复了这个问题:异步函数默认保留在调用方执行角色(Actor)上。

```swift // Swift 6.2: 正常 (OK) — 异步保留在 MainActor,无数据竞争 @MainActor final class StickerModel { let photoProcessor =

(truncated - see the full file via the links below)

File tree — 1 file
skills/swift-concurrency-6-2/SKILL.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Migrate existing Swift projects to 6.2 concurrency model with data-race safety”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

swift-concurrency-6-2
by affaan-m · affaan-m/ECC

Master Swift 6.2's concurrency paradigm where code executes on a single thread by default and background work requires explicit opt-in via @concurrent. This skill teaches you how async functions now remain on their calling actor, eliminating the implicit offloading that caused data-race errors in earlier versions. Learn to use isolated conformances for MainActor types, protect global state, and migrate existing projects incrementally while leveraging the compiler's safety guarantees.

MITupdated Jul 2026
★ 234,207repo stars
Moai Lang Swift
by mosif16 · mosif16/codex-Skills

Build scalable enterprise applications with Swift 6.0's modern concurrency model, featuring async/await, actor isolation, and structured concurrency. This skill covers SwiftUI for declarative interfaces, Combine for reactive programming, and Vapor for server-side development, plus architectural patterns like MVVM and Clean Architecture. Context7 MCP integration provides real-time access to official Swift documentation.

no license declared → metadata onlyupdated Nov 2025
★ 18repo stars
Swift Ios Migration
by xtone · xtone/ai_development_tools

This skill guides developers through converting legacy iOS applications from Objective-C to Swift, covering the technical and architectural decisions needed for a successful transition. Learn strategies for managing dependencies, refactoring code patterns, and maintaining app stability during the migration process.

no license declared → metadata onlyupdated Jun 2026
★ 3repo stars
swift-concurrency-updates
by rshankras · rshankras/claude-code-apple-skills

This skill guides you through Swift 6.2's "Approachable Concurrency" features that simplify strict concurrency adoption. Discover how default MainActor inference eliminates manual annotations, how async functions now stay on their calling actor, and how to use @concurrent for explicit background execution. Perfect for migrating from Swift 6.0/6.1 or resolving data-race errors with the latest toolchain.

MITupdated Jul 2026
★ 565repo stars
swift-concurrency-expert
by Dimillian · Dimillian/Skills

This skill diagnoses and resolves Swift Concurrency issues in modern Swift codebases through systematic triage and targeted fixes. It handles actor isolation, Sendable safety, and async/await migration while preserving existing behavior and ensuring test suite compatibility.

MITupdated Mar 2026
★ 3,861repo stars
concurrency-patterns
by rshankras · rshankras/claude-code-apple-skills

Navigate Swift's modern concurrency model with patterns for async/await, structured task management, actor-based isolation, and Swift 6.2 features. This skill guides you through compiler errors, data race prevention, and migration strategies—whether you're bridging legacy APIs or adopting strict concurrency in new code.

MITupdated Jul 2026
★ 565repo stars

More skills swift-concurrency (MIT) · Swift (unlicensed) · memory (MIT) · axiom-audit-concurrency (MIT) · swift-development (MIT) · swift-actor-persistence (MIT)

Tags
actor-isolationthread-safetycompile-time-safetyasync-awaitui-threadingbackground-offloaddata-race-preventionincremental-adoptionperformance-tuningswift-evolution