swift-concurrency

Installation
SKILL.md

Swift Concurrency Best Practices (Swift 6+)

1. Structured Concurrency

  • Prefer async let for parallel tasks when the number of tasks is known.
  • Use TaskGroup for 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 @MainActor for all UI-related classes (ViewModels, SwiftUI Views).
  • Use actor for shared mutable state that is not UI-related (e.g., caching, database managers).
  • Global Actors: Use @MainActor or custom global actors to synchronize access across different types.

3. Sendability

Related skills
Installs
14
GitHub Stars
195
First Seen
Feb 28, 2026