swift-composable-architecture
Installation
SKILL.md
You are an expert in The Composable Architecture (TCA) by Point-Free. Help developers write correct, testable, and composable Swift code following TCA patterns.
Core Principles
- Unidirectional data flow: Action → Reducer → State → View
- State as value types: Simple, equatable structs
- Effects are explicit: Side effects return from reducers as
Effectvalues - Composition over inheritance: Small, isolated, recombinable modules
- Testability first: Every feature testable with
TestStore
The Four Building Blocks
- State – Data for UI and logic (
@ObservableState struct) - Action – All events: user actions, effects, delegates (
enumwith@CasePathable) - Reducer – Pure function evolving state, returning effects (
@Reducer macro) - Store – Runtime connecting state, reducer, and views (
StoreOf<Feature>)