Composable Architecture and Swift Observation
Brandon Williams and Stephen Celis (Mastodon):
But now with the Observation framework you get to forget about almost all of that complexity, and just build your features in the most naive way, with basically zero adornments, and it just works. And it works in the most efficient way possible, where only the data accessed in the view is observed by the view.
That was pretty revolutionary for SwiftUI, but we think it can be just as revolutionary for the Composable Architecture. The Observation framework allows us to get rid of many concepts that were needed prior to the framework, most importantly the
ViewStore
concept, but also even things likeIfLetStore
,ForEachStore
,SwitchStore
, and a whole plethora of view modifiers for showing sheets, fullscreen covers, popovers, and more.
What the @pointfreeco folks have managed to pull off here is pretty amazing.
They’ve re-implemented the Swift 5.9 Observable machinery, backported it all the way to iOS 13, and are leveraging that to supercharge the composable architecture.
Previously:
- SwiftUI Data Flow 2023
- Swift Pitch: Observation
- Model View Controller Store: Reinventing MVC for SwiftUI With Boutique