swift-concurrency
Installation
SKILL.md
Swift Concurrency Best Practices (Swift 6+)
1. Structured Concurrency
- Prefer
async letfor parallel tasks when the number of tasks is known. - Use
TaskGroupfor a dynamic number of parallel tasks. - Avoid
Task { ... }(unstructured) unless bridging from synchronous code (e.g., UI event handlers) or firing background work that outlives the scope.
2. Actors & Isolation
- Default to
@MainActorfor all UI-related classes (ViewModels, SwiftUI Views). - Use
actorfor shared mutable state that is not UI-related (e.g., caching, database managers). - Global Actors: Use
@MainActoror custom global actors to synchronize access across different types.
3. Sendability
Related skills
More from tryswift/try-swift-tokyo
tca
Expert guidance on The Composable Architecture (TCA) for Swift, focusing on ReducerProtocol, macros, and testability.
32vapor
Expert guidance for Vapor 4+ development, focusing on async/await, Fluent, and content negotiation.
15ignite
Guidelines for building static sites using the Ignite Swift framework.
14skip
Guidelines for Android development using the Skip framework (Swift to Kotlin transpilation).
1asc-submit
Build, archive, export, and upload the try! Swift Tokyo app to App Store Connect for iOS, macOS, and visionOS using ASC CLI.
1playwright
Patterns for Playwright E2E testing with custom fixtures, role-based selectors, and assertion patterns.
1