Repolode
pointfreeco

pointfreeco/swift-composable-architecture

A Swift library for building Apple-platform apps with consistent state management, composable features, side-effect control, and strong testing support.

Stars
14,979
Forks
1,678
Open issues
26
Last commit
14 days ago

What is it?

The Composable Architecture (TCA) is a Swift library for building applications in a consistent, testable way. It structures a feature around a State type, an Action type, a Reducer that evolves state and returns effects, and a Store that runs the logic and drives the UI in SwiftUI or UIKit.

Large features can be split into smaller, isolated components and glued back together, which supports modular codebases spanning multiple Xcode targets or Swift packages. Side effects such as network requests are returned from reducers as values, so they can be replaced with mock dependencies in tests. The library includes a TestStore that asserts how state changes step by step as actions are sent and effects feed data back.

The project supports iOS, macOS, iPadOS, visionOS, tvOS and watchOS, and ships a set of example apps including Todos, Tic-Tac-Toe, Voice Memos and SyncUps, along with documentation and articles on navigation, dependencies and testing.

Key features

  • 01Models feature state as simple value types with Action-driven updates.
  • 02Composes large features from smaller reducers that can live in separate modules.
  • 03Returns side effects from reducers so they can be replaced in tests.
  • 04Provides a TestStore for step-by-step assertions on state and effects.
  • 05Includes a dependency system for injecting live and test implementations.
  • 06Works with SwiftUI and UIKit across Apple platforms.

Use cases

  • Building a SwiftUI iOS app with many screens that share state.
  • Splitting a large Xcode project into feature modules with clear boundaries.
  • Writing unit and integration tests for app logic that involves network calls.
  • Migrating a UIKit app toward a unidirectional, testable architecture.

Quick start

  1. 1

    Add the package dependency in Xcode or Package.swift

  2. 2

    Import the library in your code

    import ComposableArchitecture
  3. 3

    Define a @Reducer with State, Action and body, then create a Store in your app

Things to know

  • Targets Apple platforms only (iOS, macOS, iPadOS, visionOS, tvOS, watchOS).
  • Requires learning its own concepts (state, actions, reducers, effects, stores) before it feels natural.

Topics

FAQ

What is swift-composable-architecture?
A Swift library for building Apple-platform apps with consistent state management, composable features, side-effect control, and strong testing support. The Composable Architecture (TCA) is a Swift library for building applications in a consistent, testable way. It structures a feature around a State type, an Action type, a Reducer that evolves state and returns effects, and a Store that runs the logic and drives the UI in SwiftUI or UIKit.
Is swift-composable-architecture free to use? What license does it have?
swift-composable-architecture is open source under the MIT license. Check the license terms before using it in commercial products.
Is swift-composable-architecture still maintained?
Actively maintained. The last commit to swift-composable-architecture was on Oct 6, 2026.
What can I use swift-composable-architecture for?
Building a SwiftUI iOS app with many screens that share state. Splitting a large Xcode project into feature modules with clear boundaries. Writing unit and integration tests for app logic that involves network calls. Migrating a UIKit app toward a unidirectional, testable architecture.
How do I install swift-composable-architecture?
Add the package dependency in Xcode or Package.swift Import the library in your code: import ComposableArchitecture Define a @Reducer with State, Action and body, then create a Store in your app
Where can I get swift-composable-architecture?
The source code and installation instructions are on GitHub: https://github.com/pointfreeco/swift-composable-architecture

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects