I'm trying to create a basic time tracking app using SwiftUI and the ComposableArchitecture. But I'm struggling with how I should think about modeling the data structure/app state in a modular way. The app is a time tracking app, so it has: a Project
, which can have zero or more Task
's, which can have zero or more Activity
entries.
Below is a diagram of my current structure.
The problem is that I get is that with this structure is that now ProjectState
has two different list of tasks. One through project.tasks
, and another through tasks: IdentifiedArrayOf<TaskState>
.
How should I think about modeling this?
I don't want to merge data model and the app state, since the app states are more view specific, and might add view specific state, which might differ in different places. The data model is the general model that will be used throughout the app. That's why it might be good to have a relationship between Project->Task->Activity
. But the composable architecture app state also needs a similar relationship between it's different states.