Observable Architecture: Observing Bindings

Episode #265 • Jan 22, 2024 • Subscriber-Only

We have iterated on how bindings work in the Composable Architecture many times, but have never been fully happy with the results. With Observation, that all changes. By eliminating view stores and observing store state directly, we are free to totally reimagine bindings in the Composable Architecture, and get rid of even more concepts in the process.

Observing Bindings
Introduction
00:05
Simpler bindings in theory
01:32
Simpler bindings made a reality
08:08
Next time: The point
18:03

Unlock This Episode

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

Introduction

Brandon: We have now see that the new observation tools in Swift 5.9 has revolutionized nearly every part of the Composable Architecture. We have been able to completely remove large swaths of concepts that previously were required to make efficient features, and replace it with far more vanilla Swift and SwiftUI constructs. And we can now do less work to implement our features while somehow magically making our features more correct and more performant.

There is one last area of the Composable Architecture that we want to show off to see how the new observation tools can improve the situation. And this is an area of the Composable Architecture that has been thorny from day 1. And that is bindings.

Stephen: When we first released the Composable Architecture we did not provide any special tools for bindings, which mean that your reducers would become very verbose since you would need a dedicated action for each UI component that uses bindings, and you would need to handle all those actions in the reducer.

Eventually we did provide some tools that made the situation a lot better, but there were lots of caveats to those tools. And we have multiple times tried to soften those caveats and fill in the gaps, and multiple times we have failed to come up with something that we were truly happy with.

Well, the new Observation tools in Swift 5.9 finally allow us to implement bindings in the library how we hoped we could from the very first days of the Composable Architecture. We again get to remove superfluous concepts from the library, and use simpler, more familiar constructs.

Let’s take a look.

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