So this is all looking absolutely incredible. We are finding that by having the view automatically subscribe to the minimal amount of state that it needs access to, we allow ourselves to greatly simplify the tools that the Composable Architecture provides. We no longer need to hide little efficiency tricks inside dedicated view helpers, like the IfLetStore
, and instead we can just access the state directly, do a regular, vanilla Swift if let
, and everything just works as we expect. This is going to have a huge impact on applications built with the Composable Architecture.
But we can take things further. There are more special view helpers in the library that exist only because we needed a way to minimally observe state. One such example is the SwitchStore
, which allows you to model your domains with enums while still allowing you to split off child stores focused in on one particular case of the enum. It’s a powerful tool, but turns out it is completely unnecessary in a world of observation.
Let’s take a look.