{"enrichment":{"faq":[{"a":"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.","q":"What are swift 6.2 concurrency patterns for data safety?"},{"a":"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\u2014the compiler will flag unsafe patterns and guide you toward safe isolated conformances and explicit offloading.","q":"How do I fix data race errors in Swift 6.2?"},{"a":"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.","q":"What is MainActor isolation and how do isolated conformances work?"},{"a":"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\u2014image processing, heavy calculations, file I/O\u2014that 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.","q":"When should I use @concurrent in Swift 6.2 for background work?"},{"a":"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\u2014enable it incrementally, fix compiler warnings, and gradually adopt isolated conformances and explicit offloading patterns.","q":"How do I enable Approachable Concurrency in Xcode for Swift 6.2?"},{"a":"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\u2014the 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\u2014isolated > @concurrent > nonisolated\u2014reflects increasing risk and should guide your migration strategy.","q":"What's the difference between nonisolated and @concurrent in Swift 6.2?"}],"shadow_tags":["actor-isolation","thread-safety","compiler-driven","migration-guide","performance-tuning","ui-architecture","data-race-prevention","explicit-concurrency","swift-6-2"],"summary_rewrite":"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."},"files":[{"bytes":8010,"path":"skills/swift-concurrency-6-2/SKILL.md","sha256":"f12ca9feeed25834fc06f59a70c679629962a4653c8354ecd833b68403da652c","url":"https://skillfed.io/files/affaan-m/ECC/swift-concurrency-6-2/d47f294d/SKILL.md"}],"id":"affaan-m/ECC/swift-concurrency-6-2","links":{"html":"https://skillfed.io/affaan-m/ECC/swift-concurrency-6-2","md":"https://skillfed.io/affaan-m/ECC/swift-concurrency-6-2.md","repo":"https://github.com/affaan-m/ECC"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":35692,"language":"JavaScript","last_updated":"2026-07-27","license":"MIT","name":"swift-concurrency-6-2","publisher":"affaan-m","stars":234207},"relations":{"similar":[{"id":"xu-xiang/everything-claude-code-zh/swift-concurrency-6-2"},{"id":"dpearson2699/swift-ios-skills/swift-concurrency"},{"id":"rshankras/claude-code-apple-skills/concurrency"},{"id":"Dimillian/Skills/swift-concurrency-expert"},{"id":"steipete/agent-scripts/swift-concurrency-expert"},{"id":"jamesrochabrun/skills/swift-concurrency"},{"id":"AvdLee/Swift-Concurrency-Agent-Skill/swift-concurrency"},{"id":"sammcj/agentic-coding/swift-development"},{"id":"rshankras/claude-code-apple-skills/swift"},{"id":"rshankras/claude-code-apple-skills/concurrency-patterns"}]},"slug":{"owner":"affaan-m","repo":"ECC","skill":"swift-concurrency-6-2"},"version":"d47f294d"}
