
Swift Concurrency 6 2
Apply Swift 6.2 Approachable Concurrency patterns—single-threaded default, @concurrent offload, isolated conformances—to fix data races while building iOS/macOS features.
Overview
Swift Concurrency 6.2 is an agent skill for the Build phase that documents Approachable Concurrency patterns—single-threaded-by-default async, @concurrent offload, and isolated conformances—for MainActor Swift apps.
Install
npx skills add https://github.com/affaan-m/everything-claude-code --skill swift-concurrency-6-2What is this skill?
- Swift 6.2 model: async functions single-threaded by default; use @concurrent for explicit background CPU work
- Fixes Swift 6.1 implicit offload data-race errors (e.g. MainActor type calling photoProcessor off actor)
- Isolated conformances for MainActor-isolated types implementing protocols
- Migration triggers: Swift 5.x / 6.0–6.1 → 6.2 and Approachable Concurrency build settings in Xcode 26
- Documented before/after patterns for StickerModel-style PhotosPicker + processor flows
- Targets Swift 6.2 Approachable Concurrency and Xcode 26 build settings
- Documents Swift 6.1 vs 6.2 behavior change for implicit async offload
Adoption & trust: 4.4k installs on skills.sh; 210k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Swift 6 app fails concurrency checks or races because async work was implicitly offloaded from MainActor-isolated UI and model code.
Who is it for?
Solo developers shipping SwiftUI/UIKit apps who are upgrading toolchains and need concrete migration snippets.
Skip if: Greenfield server-side Swift-only services, non-Apple platforms, or teams that are not enabling Swift 6 strict concurrency yet.
When should I use this skill?
Migrating to Swift 6.2, resolving data-race safety errors, MainActor architecture, @concurrent background offload, isolated conformances, or Approachable Concurrency in Xcode 26.
What do I get? / Deliverables
You refactor toward 6.2 defaults, place heavy work behind explicit @concurrent boundaries, and align conformances and build settings with Approachable Concurrency in Xcode 26.
- Refactored concurrency patterns aligned to Swift 6.2 defaults
- Guidance on @concurrent boundaries and isolated protocol conformances
Recommended Skills
Journey fit
Mobile Swift UI and model code lives in Build; this skill targets MainActor app architecture and compiler-ready concurrency during feature implementation. Frontend subphase covers SwiftUI/UIKit layers where MainActor isolation, PhotosPicker flows, and protocol conformances on UI-bound types most often break under Swift 6.
How it compares
Opinionated migration patterns for Swift 6.2—not a generic linter or a cross-language threading guide.
Common Questions / FAQ
Who is swift-concurrency-6-2 for?
Indie and solo Apple-platform developers migrating apps to Swift 6.2 who hit MainActor, Sendable, or isolated conformance errors during feature work.
When should I use swift-concurrency-6-2?
Use it during Build when migrating to Swift 6.2, fixing data-race compiler errors, structuring MainActor apps, offloading CPU work explicitly, or enabling Approachable Concurrency in Xcode 26.
Is swift-concurrency-6-2 safe to install?
It is documentation-style guidance without mandatory shell or network access; review the Security Audits panel on this Prism page for the parent repo.
SKILL.md
READMESKILL.md - Swift Concurrency 6 2
# 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 // 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 } // Error: Sending 'self.photoProcessor' risks causing data races return await photoProcessor.extractSticker(data: data, with: item.itemIdentifier) } } ``` Swift 6.2 fixes this: async functions stay on the calling actor by default. ```swift // Swift 6.2: OK — async stays on MainActor, no data race @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 } return await photoProcessor.extractSticker(data: data, with: item.itemIdentifier) } } ``` ## Core Pattern — Isolated Conformances MainActor types can now conform to non-isolated protocols safely: ```swift protocol Exportable { func export() } // Swift 6.1: ERROR — crosses into main actor-isolated code // Swift 6.2: OK with isolated conformance extension StickerModel: @MainActor Exportable { func export() { photoProcessor.exportAsPNG() } } ``` The compiler ensures the conformance is only used on the main actor: ```swift // OK — ImageExporter is also @MainActor @MainActor struct ImageExporter { var items: [any Exportable] mutating func add(_ item: StickerModel) { items.append(item) // Safe: same actor isolation } } // ERROR — nonisolated context can't use MainActor conformance nonisolated struct ImageExporter { var items: [any Exportable] mutating func add(_ item: StickerModel) { items.append(item) // Error: Main actor-isolated conformance cannot be used here } } ``` ## Core Pattern — Global and Static Variables Protect global/static state with MainActor: ```swift // Swift 6.1: ERROR — non-Sendable type may have shared mutable state final class StickerLibrary { static let shared: StickerLibrary = .init() // Error } // Fix: Annotate with @MainActor @MainActor final class StickerLibrary { static let shared: StickerLibrary = .init() // OK } ``` ### MainActor Default Inference Mode Swift 6.2 introduces a mode where MainActor is inferred by default — no manual annotations needed: ```swift // With MainActor default inference enabled: final class StickerLibrary { static let shared: StickerLibrary = .init() // Implicitly @MainActor } final class StickerModel { let photoProcessor: PhotoProcessor var selection: [PhotosPickerItem] // Implicitly @MainActor } extension StickerModel: Exportable { // Implicitly @MainActor conformance func export() { photoProcessor.exportAsPNG() } } ``` This mode is opt-in and recommended for apps, scripts, and other executable targets. ## Core Pattern — @concur