ComposableArchitecture
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).
import ComposableArchitecture
Module information
- Declarations
- 618
- Symbols
- 1431
Additional Resources
Overview
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.
Essentials
Getting started
Learn how to integrate the Composable Architecture into your project and write your first application.
Read MoreDependencies
Learn how to register dependencies with the library so that they can be immediately accessible from any reducer.
Read MoreTesting
Learn how to write comprehensive and exhaustive tests for your features built in the Composable Architecture.
Read MoreNavigation
Learn how to use the navigation tools in the library, including how to best model your domains, how to integrate features in the reducer and view layers, and how to write tests.
Read MoreSharing state
Learn techniques for sharing state throughout many parts of your application, and how to persist data to user defaults, the file system, and other external mediums.
Read MorePerformance
Learn how to improve the performance of features built in the Composable Architecture.
Read MoreFrequently asked questions
A collection of some of the most common questions and comments people have concerning the library.
Read More
Tutorials
doc:MeetComposableArchitecture
Building SyncUps
The SyncUps application is a recreation of one of Apple’s more interesting demo applications, Scrumdinger. We recreate it from scratch using the Composable Architecture, with a focus on domain modeling, controlling dependencies, and testability.
Read More
State management
protocol Reducer<State, Action>
A protocol that describes how to evolve the current state of an application to the next state, given an action, and describes what
Effect
s should be executed later by the store, if any.struct Effect<Action>
class Store<State, Action>
A store represents the runtime that powers the application. It is the object that you will pass around to views that need to interact with the application.
Sharing state
Learn techniques for sharing state throughout many parts of your application, and how to persist data to user defaults, the file system, and other external mediums.
Read More
Testing
class TestStore<State, Action>
A testable runtime for a reducer.
Testing
Learn how to write comprehensive and exhaustive tests for your features built in the Composable Architecture.
Read More
Integrations
Adopting Swift concurrency
Learn how to write safe, concurrent effects using Swift’s structured concurrency.
Read MoreSwiftUI Integration
Integrating the Composable Architecture into a SwiftUI application.
Read MoreObservation backport
Learn how the Observation framework from Swift 5.9 was backported to support iOS 16 and earlier, as well as the caveats of using the backported tools.
Read MoreUIKit Integration
Integrating the Composable Architecture into a UIKit application.
Read More
Migration guides
Migration guides
Learn how to upgrade your application to the newest version of the Composable Architecture.
Read More
See Also
The collection of videos from Point-Free that dive deep into the development of the library.