swift-concurrency-updates
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.
Swift Concurrency Updates teaches you to adopt Swift 6.2's new concurrency defaults and migration patterns.
AI-generated summary based on this skill's SKILL.md
Install
rshankras/claude-code-apple-skills/concurrency · repository language: Swift
git clone https://github.com/rshankras/claude-code-apple-skills
cp -r claude-code-apple-skills/skills/swift/concurrency ~/.claude/skills/concurrencyFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What are the main Swift 6.2 concurrency changes?
swift-concurrency-updates covers Swift 6.2's "Approachable Concurrency" features that reduce boilerplate and simplify strict concurrency adoption. Key changes include default MainActor inference for app targets (eliminating manual @MainActor annotations), async functions now staying on their calling actor by default, and the new @concurrent attribute for explicit background execution. These improvements make migrating from Swift 6.0/6.1 less painful and help resolve data-race errors more intuitively.
How do I use @concurrent in Swift 6.2?
swift-concurrency-updates explains that @concurrent is Swift 6.2's attribute for explicitly offloading CPU-intensive work to the background. Unlike Task.detached, @concurrent provides a cleaner, more declarative way to mark functions or closures for background execution. This skill guides you through applying @concurrent to your code, understanding when it's appropriate versus other concurrency patterns, and how it integrates with the new default actor isolation behavior.
What is default MainActor inference in Swift 6.2?
swift-concurrency-updates teaches that default MainActor inference is a Swift 6.2 feature that automatically applies MainActor isolation to app targets without requiring manual @MainActor annotations on every type and method. You can enable and configure this behavior via a build setting in Xcode. This dramatically reduces boilerplate while maintaining strict concurrency checking, making it easier to adopt Swift 6.2's concurrency model.
How do async functions stay on the calling actor in Swift 6.2?
swift-concurrency-updates clarifies that in Swift 6.2, async functions now remain on their calling actor by default instead of implicitly hopping to a generic background context. This means if you call an async function from the MainActor, it stays on the MainActor unless explicitly isolated elsewhere. This behavior reduces unexpected context switches and makes concurrency more predictable, helping you resolve data-race errors and write safer concurrent code.
How do I migrate from Swift 6.0 to 6.2 concurrency?
swift-concurrency-updates provides a migration guide for moving from Swift 6.0/6.1 to 6.2 with less boilerplate. The skill shows how to leverage default MainActor inference to remove redundant annotations, adopt @concurrent for background work, and use the nonisolated keyword where isolation isn't needed. You'll learn which data-race errors are now easier to fix and how to incrementally update your codebase using Swift 6.2's new defaults.
What is the nonisolated keyword in Swift 6.2?
swift-concurrency-updates explains that nonisolated is a Swift 6.2 keyword used to mark methods or properties that don't require actor isolation, even when they're part of an actor-isolated type. This is especially useful when default MainActor inference is enabled, allowing you to explicitly opt out of isolation for specific members. Using nonisolated reduces unnecessary context hops and helps you fine-tune concurrency behavior in your app targets.
SKILL.md
rendered from the published skill — quoted content, verbatim
Swift 6.2 Concurrency Updates
Swift 6.2 introduces "Approachable Concurrency" -- a set of changes that make strict concurrency dramatically easier to adopt. Code runs on @MainActor by default, async functions stay on the calling actor, and you explicitly request background execution with @concurrent.
This skill covers only the Swift 6.2 specific changes. For general concurrency patterns (actors, TaskGroup, AsyncSequence, Sendable, cancellation), see the swift/concurrency-patterns skill.
When This Skill Activates
- User is adopting Swift 6.2 concurrency features
- User asks about default MainActor inference or the "infer main actor" build setting
- User encounters data-race errors that Swift 6.2 resolves
- User asks about
@concurrent, isolated conformances, or
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 2 files
skills/swift/concurrency/SKILL.md
skills/swift/concurrency/rules/swiftlint.yml