swift-async-stream-patterns
Installation
SKILL.md
AsyncStream & AsyncSequence Patterns
When to use
- Building custom
AsyncSequencetypes that produce values over time - Bridging synchronous/callback-based APIs to async/await
- Implementing channels, buffers, or multi-consumer broadcasting
- Handling backpressure in producer/consumer scenarios
- Creating "CurrentValue"-like semantics where late subscribers receive buffered values
Core Patterns from swift-async-algorithms
1. State Machine Pattern
Use explicit state machines with enums to model complex async behavior. State machines return actions rather than performing side effects directly. This separates state logic from async operations.