swift-concurrency
Originally fromavdlee/swift-concurrency-agent-skill
Installation
SKILL.md
Swift Concurrency
Fast Path
Before proposing a fix:
- Analyze
Package.swiftor.pbxprojto determine Swift language mode, strict concurrency level, default isolation, and upcoming features. Do this always, not only for migration work. - Capture the exact diagnostic and offending symbol.
- Determine the isolation boundary:
@MainActor, custom actor, actor instance isolation, ornonisolated. - Confirm whether the code is UI-bound or intended to run off the main actor. For delayed retries, timers, and backoff tasks, separate the waiting from the UI mutation. The sleep often belongs off the main actor even when the final state update belongs on it.
Project settings that change concurrency behavior:
| Setting | SwiftPM (Package.swift) |
Xcode (.pbxproj) |
|---|---|---|
| Language mode | swiftLanguageVersions or -swift-version (// swift-tools-version: is not a reliable proxy) |
Swift Language Version |
| Strict concurrency | .enableExperimentalFeature("StrictConcurrency=targeted") |
SWIFT_STRICT_CONCURRENCY |
| Default isolation | .defaultIsolation(MainActor.self) |
SWIFT_DEFAULT_ACTOR_ISOLATION |
| Upcoming features | .enableUpcomingFeature("NonisolatedNonsendingByDefault") |
SWIFT_UPCOMING_FEATURE_* |