swift-concurrency

Enforce Swift concurrency patterns with actors, Sendable, and MainActor discipline.

1|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/dimitriRemoiville/cc-mobile --skill swift-concurrency-dimitriremoiville
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: swift-concurrency
Source: https://github.com/dimitriRemoiville/cc-mobile/tree/main/plugins/cc-mobile-ios/skills/swift-concurrency
Command: npx skills add https://github.com/dimitriRemoiville/cc-mobile --skill swift-concurrency-dimitriremoiville

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Swift concurrency is often error-prone when crossing actor boundaries, risking data races and flaky UI. This skill prescribes safe, predictable concurrency patterns across architectures.

Core Features & Use Cases

  • Isolation model: Views, ViewModels, and coordinators should be isolated to @MainActor; repositories and long-running data sources should use actor; all pure values crossing boundaries should be Sendable; cross-boundary mutations should be guarded.
  • Key patterns: Structured concurrency with async/await, TaskGroup, and cancellation; asynchronous streams via AsyncSequence.
  • Use case: When building a SwiftUI app, ensure UI state updates happen on the main thread, while heavy data loading runs in actors with cancellation support.

Quick Start

Annotate types with @MainActor or actor, ensure Sendable conformance, and replace detached tasks with structured concurrency to enforce safe, predictable Swift concurrency.

Frequently Asked Questions about swift-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent data races when crossing actor boundaries in Swift?▼

To prevent data races across Swift actor boundaries, isolate UI layers with @MainActor, run long-running tasks in actors, and ensure all cross-boundary values conform to Sendable. Guard any mutations crossing these isolation domains.

What is the best way to handle UI state updates with Swift structured concurrency?▼

The best way to handle UI state updates with Swift structured concurrency is isolating Views and ViewModels to @MainActor. This ensures state updates occur on the main thread while heavy data loading runs independently in actors.

How do I implement cancellation in Swift AsyncSequence workflows?▼

Implement cancellation in Swift AsyncSequence workflows by applying structured concurrency with async/await and TaskGroup. Replace detached tasks with structured tasks to enforce predictable, safe cancellation across asynchronous streams.

When do I need to use Sendable conformance in Swift asynchronous workflows?▼

You need Sendable conformance in Swift asynchronous workflows when passing pure values across actor boundaries. It guarantees safe, concurrent data handling without data races when crossing between isolated contexts like @MainActor and actors.

Can I use Swift actors for long-running data loading in a SwiftUI app?▼

Yes, you can use Swift actors for long-running data loading in a SwiftUI app. Repositories and data sources should leverage actors for background processing while coordinators and ViewModels remain isolated to @MainActor.