Earlier this week we released version 1.10 of the Composable Architecture that brought powerful state sharing tools to the library. These tools allow you to seamlessly share state between multiple features, persist state to external systems such as user defaults and the file system, and your features remain 100% testable.

Today we are excited to announce a brand new tutorial that shows step-by-step how to build a complex SwiftUI application using the Composable Architecture. It is the same application we built during our 1.0 tour of the library, called SyncUps, and we also built this app in our “Modern SwiftUI” series and later open sourced it.

In the tutorial you will learn about many of the core tenets of the library, such as:

Use value types to model your domains.

In the Composable Architecture we prefer to represent our features’ domains with simple value types. This makes their logic easier to understand, more isolatable, and most testable.

Drive navigation from state.

Model the destinations a feature can navigate to in the feature’s state. This makes deep linking from push notifications, URLs, etc., as simple as constructing state, handing it off to the view, and letting SwiftUI do the heavy lifting.

Model your domains as concisely as possible.

The Composable Architecture gives you all of the tools you need to model your domains as concisely as possible. If a feature can navigate to 5 different places, there’s no need to model that as 5 separate optionals, giving you 26 invalid states (25 − 6 = 26). Instead it should be one single optional enum with 5 cases, allowing you to prove that at most a single navigation destination can be active at a time.

Control your dependencies rather than letting them control you.

Dependencies are by far the #1 source of complexity leaking into applications. With a little bit of upfront work you can take control over your dependencies so that you can run your app in completely controlled environments, such as in Xcode previews, tests, and more. And the Composable Architecture gives you all the tools you need to model, control and propagate dependences in your app.

Test the subtle edge cases of your app’s logic.

The Composable Architecture comes with world class testing tools that force you to prove how every bit of logic and behavior executes in your features, including asynchronous effects and dependencies! Test failures are printed with nicely formatted messages letting you know exactly what went wrong, and you can even control how exhaustive you want your tests to be.

Start the tutorial today!

And that is only scratching the surface of what the tutorial covers and what the library is capable of. Start the tutorial today to learn about the Composable Architecture!

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing