
The Composable Architecture
A Swift library for structuring Apple-platform apps around state, actions, and testable side effects.pointfreeco/swift-composable-architecture
- Stars
- 15k
- Forks
- 1.7k
- Licence
- MIT
- Language
- Swift
- Last update
- 9 days ago
- Type
- Library
What it is
The Composable Architecture (TCA) is a Swift library for building apps on Apple platforms in a consistent way. It organizes each feature into state, actions, and a reducer that describes how state changes, with side effects such as API requests kept explicit. It is used with SwiftUI and UIKit, and the README says it is meant to make features easier to compose from smaller parts and to test.
- Build a counter feature with increment and decrement buttons and an API call that loads a fact about the number
- Compose a large screen out of smaller feature modules glued together by a parent reducer
- Write tests that exercise a feature's state changes and effects
- Study the included examples such as Todos, Voice memos, and SyncUps to see common patterns
Great for
- Swift developers building SwiftUI or UIKit apps who want a consistent structure for features
- Teams splitting large features into smaller pieces that can be composed together
- Developers who want to write tests for business logic and side effects
- People willing to learn a new architecture pattern and its concepts
Not ideal for
- Developers who want a small, lightweight approach with few concepts, since the library has many moving parts to learn
- Non-Swift projects, because the library is written for Swift and Apple platforms
- Beginners new to Swift, since the README points to a separate tutorial and the library assumes familiarity with the language
How to get it
- 1
Install with a package manager
You'll need: Xcode with Swift Package Manager support
Add the package to your project via Swift Package Manager
git clone https://github.com/pointfreeco/swift-composable-architecture - 2
Run it
- Add the library to an Xcode project through Swift Package Manager, using the repository URL
- Import ComposableArchitecture in a Swift file
- Define a @Reducer with a State and Action, as shown in the README's basic usage example
- Create a SwiftUI view that holds a StoreOf for the reducer and sends actions to it
- 3
Get the most out of it
- Work through the 'Meet the Composable Architecture' interactive tutorial linked in the README
- Explore the Examples directory, including the Case Studies folder grouped by topic
- Use @ObservableState on State types to take advantage of the library's observation tools
- Write reducer tests to check state changes and effects, as the README's testing section describes
Downloads
Strengths
- The README describes a clear split between state, actions, reducers, and stores, which gives features a predictable shape
- Side effects are returned from the reducer, which the README says makes them easier to test
- Includes many example apps and a case studies directory to learn from
Trade-offs
- Requires learning its own concepts and conventions before it feels natural
- Its macros and API are tied to Swift and Apple platforms, so it does not transfer to other ecosystems
- The README excerpt provided is truncated, so details of installation and version compatibility could not be confirmed here
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| swift-composable-architecture (this) | 15k | Library | intermediate | 9 days ago | Swift developers building SwiftUI or UIKit apps who want a consistent structure for features |
| SwifterSwift | 15.3k | Library | beginner | 4 days ago | Swift developers building iOS or macOS apps who want common helper methods ready to use |
| diagrams | 42.8k | Library | beginner | 4 days ago | Engineers who want to sketch a cloud architecture quickly without a drawing tool |
| kratos | 26k | Library | intermediate | 4 days ago | Go developers building a set of backend services that talk over HTTP or gRPC |
| clean-code-javascript | 94.7k | Learning resource | beginner | 2.3 years ago | Developers who want to improve the readability of their JavaScript code |
| chakra-ui | 40.7k | Library | intermediate | 4 days ago | React developers who want prebuilt UI components instead of styling from scratch |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.