The Composable Architecture
The Composable Architecture (TCA, for short) is a library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind. It can be used in SwiftUI, UIKit, and more, and on any Apple platform (iOS, macOS, tvOS, and watchOS).
What is the Composable Architecture?
This library provides a few core tools that can be used to build applications of varying purpose and complexity. It provides compelling stories that you can follow to solve many problems you encounter day-to-day when building applications, such as:
- State management
How to manage the state of your application using simple value types, and share state across many screens so that mutations in one screen can be immediately observed in another screen.
Composition
How to break down large features into smaller components that can be extracted to their own, isolated modules and be easily glued back together to form the feature.Side effects
How to let certain parts of the application talk to the outside world in the most testable and understandable way possible.Testing
How to not only test a feature built in the architecture, but also write integration tests for features that have been composed of many parts, and write end-to-end tests to understand how side effects influence your application. This allows you to make strong guarantees that your business logic is running in the way you expect.Ergonomics
How to accomplish all of the above in a simple API with as few concepts and moving parts as possible.
Learn More
The Composable Architecture was designed over the course of many episodes on Point-Freeopen in new window, a video series exploring functional programming and the Swift language, hosted by Brandon Williamsopen in new window and Stephen Celisopen in new window.
Articles
Videos:
A Tour of the Composable Architecture:
Also you can watch all of the episodes hereopen in new window.
Code:
- The Composable Architectureopen in new window
- isowordsopen in new window
- Milestonesopen in new window
- Wishlistopen in new window
- Visits appopen in new window
- SwiftUI Navigation with Composable Architectureopen in new window
Requirements
The Composable Architecture depends on the Combine framework, so it requires minimum deployment targets of iOS 13, macOS 10.15, Mac Catalyst 13, tvOS 13, and watchOS 6. If your application must support older OSes, there are forks for ReactiveSwiftopen in new window and RxSwiftopen in new window that you can adopt!
Documentation
The latest documentation for the Composable Architecture APIs is available hereopen in new window.
Other libraries
The Composable Architecture was built on a foundation of ideas started by other libraries, in particular Elmopen in new window and Reduxopen in new window.