> swift-concurrency

Standards for async/await, Actors, Task Groups, and MainActor. Use when implementing Swift async/await, Actors, or structured concurrency in iOS/macOS. (triggers: **/*.swift, async, await, actor, Task, MainActor)

fetch
$curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/swift-concurrency?format=md"
SKILL.mdswift-concurrency

Swift Concurrency

Priority: P0

Implementation Guidelines

async/await

  • Async Functions: Mark with async, call with await.
  • Error Handling: Combine with throws for async throwing functions.
  • No Completion Handlers: Prefer async over callback-based APIs.

Actors

  • Data Isolation: Use actor for mutable state accessed from multiple tasks.
  • MainActor: Annotate UI code with @MainActor for main thread execution.
  • Actor Isolation: All actor properties/methods are isolated automatically.

Task Management

  • Structured Concurrency: Use Task {}, async let, TaskGroup.
  • Cancellation: Check Task.isCancelled, propagate cancellation.
  • Detached Tasks: Avoid Task.detached unless necessary.

Anti-Patterns

  • Blocking Main Thread: **No synchronous work in @MainActor**: Use Task.
  • Missing MainActor: **UI updates must be @MainActor**: Compiler error.
  • Ignoring Cancellation: **Check Task.isCancelled**: Respect cancellation.

References

┌ stats

installs/wk0
░░░░░░░░░░
github stars341
██████████
first seenMar 17, 2026
└────────────

┌ repo

HoangNguyen0403/agent-skills-standard
by HoangNguyen0403
└────────────

┌ tags

└────────────