Modular features and sharing state

I am unsure how this will work with UITabBarControllers and modularization. The examples provided seem to couple the Navigation state with the main App state. In the tic tac toe example, new game state owns a Game, and that is how it determines when it's time to push on the GameViewController. What if other pieces of the app state needed to share that same Game state but weren’t shown from the NewGameViewController?

My current app uses a redux approach where my main App State is segmented into 3 slices: Domain State, UI State, and Navigation State. Since I’m using a UITabBarController, multiple tabs need to have access to the same domain state. An example is on one tab you have a list of posts, and you can favorite one, and on another tab you can see the list of favorites. Would this slicing of state be something that would work with the composable architecture pattern? My first thought is this sort of plucking off the main state into what each view needs is exactly what the ViewStore is for. I’m just still a little unsure how the navigation state would fit into the picture at that point. Especially if each tab is its own 'feature' broken out into a framework.

My goal is to have each feature be able to be ran in isolation without knowing about another features state. Usually I have a parent framework that houses a bunch of feature protocols so features can be injected into other features without having to depend on them. But it seems like maybe we have to do the inverse here?

Terms of Service

Privacy Policy

Cookie Policy