Observable Architecture: The Point

Episode #266 • Jan 29, 2024 • Subscriber-Only

So what’s the point of observation in the Composable Architecture? While we have seemingly simplified nearly every inch of the library as it interfaces with SwiftUI, let’s zoom out a bit, explore how some integration tests that benchmark certain aspects of the library have changed, and migrate the Todos application we built in the very first tour of this library to the new tools.

Previous episode
Observable Architecture: The Point
Next episode
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Brandon

So, this is pretty incredible. We have now modernized pretty much ever facet of the Composable Architecture by deeply integrating Observation into the library. We’ve made views more efficient, we’ve removed boilerplate from features built in the library, and we’ve removed many concepts that were previously necessary to implement features but no longer are.

Stephen

With each change we made to the library we made it a point to demonstrate that views observed the minimal amount of state possible even though we were using simpler, more implicit tools. But now we want to see this even more concretely.

We have an entire integration test suite that is dedicated to running a Composable Architecture feature in the simulator, tapping around on various things, and asserting exactly how many stores are created and destroyed, how many times the scope operation on stores is called, and how many times view bodies are re-computed.

It turns out that all of the changes made so far greatly reduce the amount of the work the library needs to do its job. Let’s take a look at the test suite, and see how things improved.

Measuring observation improvements


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