swift-concurrency
Installation
SKILL.md
Swift Concurrency Skill
This skill provides expert guidance on Swift's concurrency system based on the mental models from Fucking Approachable Swift Concurrency.
Core Mental Model: The Office Building
Think of your app as an office building where isolation domains are private offices with locks:
- MainActor = Front desk (handles all UI interactions, only one exists)
- actor types = Department offices (Accounting, Legal, HR - each protects its own data)
- nonisolated code = Hallways (shared space, no private documents)
- Sendable types = Photocopies (safe to share between offices)
- Non-Sendable types = Original documents (must stay in one office)
You can't barge into someone's office. You knock (await) and wait.
Async/Await
An async function can pause. Use await to suspend until work finishes: