Swift 6.2 Approachable Concurrency — single-threaded by default, @concurrent for explicit background offloading, isolated conformances for main actor types.
Install the skill above, then run this in your AI tool:
/swift-concurrency-6-2 <your description>
About
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.
Source
What gets added to your project
Preview every file this package writes on install before you run the command above.
Summary
2 Approachable Concurrency — single-threaded by default, @concurrent for explicit background offloading, isolated conformances for main actor types. 2 concurrency — offloading with @concurrent or resolvi...
Skill instructions
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@MainActorfinalclassStickerModel {
let photoProcessor =PhotoProcessor()
funcextractSticker(_item: PhotosPickerItem) asyncthrows -> Sticker? {
guardlet data =tryawait item.loadTransferable(type: Data.self) else { returnnil }
// Error: Sending 'self.photoProcessor' risks causing data racesreturnawait 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@MainActorfinalclassStickerModel {
let photoProcessor =PhotoProcessor()
funcextractSticker(_item: PhotosPickerItem) asyncthrows -> Sticker? {
guardlet data =tryawait item.loadTransferable(type: Data.self) else { returnnil }
returnawait photoProcessor.extractSticker(data: data, with: item.itemIdentifier)
}
}
Core Pattern — Isolated Conformances
MainActor types can now conform to non-isolated protocols safely:
swift
protocolExportable {
funcexport()
}
// Swift 6.1: ERROR — crosses into main actor-isolated code// Swift 6.2: OK with isolated conformanceextensionStickerModel: @MainActorExportable {
funcexport() {
photoProcessor.exportAsPNG()
}
}
The compiler ensures the conformance is only used on the main actor:
swift
// OK — ImageExporter is also @MainActor@MainActorstructImageExporter {
var items: [anyExportable]
mutatingfuncadd(_item: StickerModel) {
items.append(item) // Safe: same actor isolation
}
}
// ERROR — nonisolated context can't use MainActor conformancenonisolatedstructImageExporter {
var items: [anyExportable]
mutatingfuncadd(_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 statefinalclassStickerLibrary {
staticlet shared: StickerLibrary= .init() // Error
}
// Fix: Annotate with @MainActor@MainActorfinalclassStickerLibrary {
staticlet shared: StickerLibrary= .init() // OK
}
MainActor Default Inference Mode
Swift 6.2 introduces a mode where MainActor is inferred by default — no manual annotations needed:
This mode is opt-in and recommended for apps, scripts, and other executable targets.
Core Pattern — @concurrent for Background Work
When you need actual parallelism, explicitly offload with @concurrent:
Important: This example requires Approachable Concurrency build settings — SE-0466 (MainActor default isolation) and SE-0461 (NonisolatedNonsendingByDefault). With these enabled, extractSticker stays on the caller's actor, making mutable state access safe. Without these settings, this code has a data race — the compiler will flag it.
Add this badge to a GitHub README so readers can open the package page and install the same version.
[](https://www.aipm-registry.com/skills/affaan-m/swift-concurrency-6-2/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)
This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.
AI assistant context
What this skill is for
@affaan-m/swift-concurrency-6-2@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: Swift 6.2 Approachable Concurrency — single-threaded by default, @concurrent for explicit background offloading, isolated conformances for main actor types. Use when adopting Swift 6.2 concurrency — offloading with @concurrent or resolvi...
Preview a UI component mockup in a local browser canvas where the human directly edits it (move, resize, edit text, delete, restyle), switches mobile/desktop/custom viewports, tests it, chats with you, and clicks Save and Finish. You the...
Run aipm add @affaan-m/swift-concurrency-6-2@1.0.0 in a project that has AIPM initialized.
Supported tools
@affaan-m/swift-concurrency-6-2@1.0.0 supports All tools.
Before installing
AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.