Observable Architecture: Structural Identity

Episode #260 • Dec 4, 2023 • Subscriber-Only

One of the core tenets of the Composable Architecture is that you should be able to model your application’s state using simple value types, like structs and enums. However, the @Observable macro does not work with value types at all, and so in order to enhance the Composable Architecture with Observation we will need to contend with this issue and explore what it means for a struct to be observable.

Structural Identity
Observing structs naively
Observing structs with identity
Next time: observing optionality

Unlock This Episode

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


Brandon: OK, that was a fun sneak peek at what the final tools will offer you. But I don’t think our viewers are watching this episode right now just to show how to use the new tools. They can check out the observation-beta branch and all of the demos and case studies to get that information.

Stephen: Instead, I think our viewers are a lot more interested in learning how we accomplished all of this in the library. That is where we get to show off some really advanced techniques in the Swift language, and help people get a deeper understanding of how the library works. One of the best things about the Composable Architecture is not just that it’s a nice library to use, but also that nearly every decision that went into designing it the way that it is is well documented in this video series. And we’re not going to change that now.

So, let start by trying to naively integrate the Observation framework into the Composable Architecture as it exists in its last public release, and see how far we can get before we run into problems. That will help us figure out where we need to deviate from Apple’s tools in order to achieve our goals.

This episode is for subscribers only.

Subscribe to Point-Free

Access this episode, plus all past and future episodes when you become a subscriber.

See plans and pricing

Already a subscriber? Log in