How can The Composable Architecture really become composable?

Yes, its a shame it requires that level of boilerplate though.

1 Like

You can indeed set some private variable for internal storage and use it to bootstrap your state's value before updating it in the getter. You only have to set it back the other way, in the getter.

This is what I'm using in this PR. Its purpose is to reduce boilerplate as much as possible. There's still some left, but it's already better than setting everything by hand each time, and it avoids a whole class if errors (forgetting to set back some properties in the setter when needed for example).

I guess TCA comes at the price of a constant complexity. It is a little too complex for simple setups, but it stays manageable as you're adding features, where some other solution would explode. I still have some monsters "ObervableObjects in ObservableObjets with bindings between" from pre-TCA that I need to untangle in my apps.

I think a lot of these issues can be alleviated if one gets build scripts in SPM (:crossed_fingers:), so we can run custom codegen when the package is being built.