explaingit

pointfreeco/swift-composable-architecture

Analysis updated 2026-06-24

14,627SwiftAudience · developerComplexity · 4/5Setup · moderate

TLDR

Swift library by Point-Free for building Apple-platform apps with a single state store, typed actions, reducers, and testable side effects, working with SwiftUI and UIKit.

Mindmap

mindmap
  root((swift-composable-architecture))
    Inputs
      User actions
      API responses
      Reducer logic
    Outputs
      App state
      UI updates
      Side effects
    Use Cases
      Build a SwiftUI app
      Structure shared state
      Write testable features
      Compose modular screens
    Tech Stack
      Swift
      SwiftUI
      UIKit
      Combine
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a SwiftUI iOS app with one source of truth across screens

USE CASE 2

Split a large feature into composable reducer modules that can be tested in isolation

USE CASE 3

Model side effects like network calls so they can be unit tested with controlled clocks

USE CASE 4

Reuse the same architecture across iOS, macOS, watchOS, tvOS, and visionOS targets

What is it built with?

SwiftSwiftUIUIKitCombine

How does it compare?

pointfreeco/swift-composable-architecturemxcl/promisekitwhisky-app/whisky
Stars14,62714,24315,026
LanguageSwiftSwiftSwift
Setup difficultymoderateeasymoderate
Complexity4/52/53/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

The mental model of State, Action, Reducer, Store, and Effect takes time to absorb even though installation via SPM is one step.

In plain English

The Composable Architecture, shortened to TCA in the README, is a Swift library for structuring apps that run on Apple platforms. The README lists iOS, macOS, iPadOS, visionOS, tvOS, and watchOS as supported, and says the library works with both SwiftUI and UIKit, the two main user-interface toolkits Apple developers choose between. The pitch is that it gives a consistent shape for an app's code so that the same patterns work whether the screen is tiny, like a watch face, or large, like a Mac window. The README breaks the problem the library is solving into five themes. State management is about keeping a single source of truth for the data a feature needs, with that data shared across screens so that a change in one place shows up everywhere. Composition is about splitting a big feature into smaller pieces that can live in their own modules and be plugged back together. Side effects covers anything that talks to the outside world, like network calls, in a way that stays testable. Testing covers writing unit, integration, and end-to-end tests for features built with the library. Ergonomics is about doing all of the above with as few moving parts as possible. To build one feature, the README says you define four things. State is a type holding the data the feature works with. Action is a type listing everything that can happen, from a button press to a network reply. Reducer is a function describing how the current state turns into the next state given an action, and what side effects should run. Store is the runtime that wires these together: actions are sent into the store, the reducer processes them, effects execute, and the UI observes state changes. The README walks through a small example: a counter screen with plus and minus buttons and a third button that fetches a random fact about the current number from an API. It shows a struct annotated with the @Reducer macro, a State with a count integer and an optional number fact string, an Action enum listing the three button taps plus a separate case for the API response, and a body property that switches on the action and updates state or returns no effect. The library grew out of an episode series on Point-Free, a paid video site about advanced Swift programming run by Brandon Williams and Stephen Celis. The repository ships many example apps including a search demo, speech recognition, voice memos, todos, and tic-tac-toe, along with case studies covering navigation, effects, and reusable components. A bigger example is isowords, an iOS word game whose source is open.

Copy-paste prompts

Prompt 1
Give me a 5-minute setup guide for adding swift-composable-architecture to a SwiftUI app via Swift Package Manager
Prompt 2
Show me a minimal Reducer with State, Action, and a body that handles two button taps and one API response
Prompt 3
Convert a screen with @State and @ObservedObject to TCA with Store, ViewStore, and a Reducer
Prompt 4
How do I write a unit test for a TCA reducer that has a network effect using a test clock
Prompt 5
Walk me through composing two child reducers into a parent reducer using Scope in TCA

Frequently asked questions

What is swift-composable-architecture?

Swift library by Point-Free for building Apple-platform apps with a single state store, typed actions, reducers, and testable side effects, working with SwiftUI and UIKit.

What language is swift-composable-architecture written in?

Mainly Swift. The stack also includes Swift, SwiftUI, UIKit.

How hard is swift-composable-architecture to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is swift-composable-architecture for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.