swift-concurrency-6-2
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.
Swift Concurrency 6.2 helps you migrate projects to single-threaded-by-default concurrency and eliminate data-race errors.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-27
Swift Concurrency 6.2 helps you migrate projects to single-threaded-by-default concurrency and eliminate data-race errors. 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.
Use it when
- swift-concurrency-6-2 fixes data races by changing the default behavior: async code no longer implicitly jumps to background threads.
- swift-concurrency-6-2's MainActor isolation ensures code runs on the main thread, essential for UI updates and shared state.
Verify before relying
Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.
Install
affaan-m/ECC/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
What are swift 6.2 concurrency patterns for data safety?
swift-concurrency-6-2 introduces a single-threaded default where async functions remain on their calling actor instead of implicitly offloading to background threads. This eliminates the data-race errors common in earlier versions. You explicitly opt into background work using @concurrent for CPU-intensive tasks. The key pattern is: keep UI and shared state on MainActor, mark background work with @concurrent, and use isolated conformances to safely implement protocols on MainActor types while maintaining actor isolation guarantees.
How do I fix data race errors in Swift 6.2?
swift-concurrency-6-2 fixes data races by changing the default behavior: async code no longer implicitly jumps to background threads. Instead, it stays on the calling actor. To resolve existing data-race errors, identify shared mutable state and protect it with actor isolation or MainActor. Use @concurrent to explicitly mark functions that should run in the background. Enable Approachable Concurrency build settings in Xcode to get compiler guidance. Migrate incrementally—the compiler will flag unsafe patterns and guide you toward safe isolated conformances and explicit offloading.
What is MainActor isolation and how do isolated conformances work?
swift-concurrency-6-2's MainActor isolation ensures code runs on the main thread, essential for UI updates and shared state. Isolated conformances let you implement protocols on MainActor types while preserving isolation: mark protocol methods as isolated(MainActor) so they execute on the main thread without losing actor guarantees. This pattern is safer than nonisolated, which breaks isolation. Use isolated conformances when adopting Codable, Equatable, or custom protocols on MainActor types to maintain data-race safety while meeting protocol requirements.
When should I use @concurrent in Swift 6.2 for background work?
swift-concurrency-6-2's @concurrent attribute explicitly marks functions for background execution, replacing the implicit offloading of earlier versions. Use @concurrent for CPU-intensive work—image processing, heavy calculations, file I/O—that shouldn't block the main thread. Apply it to functions that don't need MainActor isolation and can safely run in the background. The compiler enforces that @concurrent functions don't access main-thread-only state unsafely, making it the recommended way to opt into background execution while maintaining actor safety.
How do I enable Approachable Concurrency in Xcode for Swift 6.2?
swift-concurrency-6-2's Approachable Concurrency setting is configured in Xcode's build settings under Swift Compiler - Upcoming Features. Enable it to activate the single-threaded default and get compiler diagnostics for data-race issues. This setting enforces that async functions stay on their calling actor and requires explicit @concurrent for background work. It's essential for migrating from Swift 6.1 and earlier—enable it incrementally, fix compiler warnings, and gradually adopt isolated conformances and explicit offloading patterns.
What's the difference between nonisolated and @concurrent in Swift 6.2?
swift-concurrency-6-2 distinguishes these for protocol conformance safety: nonisolated removes isolation entirely, breaking actor guarantees and risking data races on MainActor types. @concurrent explicitly opts into background execution while maintaining actor safety—the compiler prevents unsafe access to isolated state. Use isolated conformances (isolated(MainActor)) for MainActor protocols instead of nonisolated. Reserve @concurrent for functions designed to run in the background. This hierarchy—isolated > @concurrent > nonisolated—reflects increasing risk and should guide your migration strategy.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
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
(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 Swift projects to 6.2 concurrency model and resolve data-race errors”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
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.
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.
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.
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.
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.
This skill helps developers resolve Swift concurrency compiler diagnostics, data-race warnings, and isolation boundary issues. It provides structured guidance for refactoring callback-based code to async/await patterns and supports Swift 6 migration across tasks, actors, @MainActor, Sendable conformance, and thread-safety concerns. The skill emphasizes smallest-safe-change fixes grounded in project settings and isolation context.
More skills concurrency-patterns (MIT) · hexagonal-architecture (MIT) · swift-development (MIT) · swift-actor-persistence (MIT)