Swift 6.2 Approachable Concurrency
Single-threaded by default; async stays on the caller, @concurrent opts into background. Detalhes em references/.
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 Principles
- Single-threaded default — async stays on calling actor, no implicit offload
- Isolated conformances —
@MainActortypes conform without workarounds @concurrentis opt-in — background only as deliberate performance choice- Inference mode — MainActor by default for app targets, less boilerplate
- Migrate incrementally — one build setting at a time, profile before offload
Example
@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)
}
}
References
references/problem-migration.md— implicit-offload problem, design decisions, migration stepsreferences/isolated-conformances.md— isolated conformances, globals/statics, inference modereferences/concurrent-background.md—@concurrentpattern with SE-0466/SE-0461 warningreferences/practices-antipatterns.md— best practices, anti-patterns, when to use
Checklist
- Approachable Concurrency settings enabled (SE-0466, SE-0461) where needed
- Globals/statics protected by MainActor or inference mode
-
@concurrentonly on profiled CPU-intensive paths with await call sites - No
nonisolatedsuppression or legacy DispatchQueue without reason