Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
How to think about model/state structure when using ComposableArchitecture?

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.

Data/state 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.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Ok, so after looking at lot's of the example projects from PointFree, I think I might have had a wrong metal model when looking at this. I think I did wrong in looking at the data model and the app state as two different things, and was looking for a way to sort of synchronise them.

In the end I just accepted that they are the same thing, and moved everything directly to the AppState. This made everything much simpler to reason about, and I could delete a lot of extra code, which might be a hint that this was a good path to take.

But I would still love some feedback if anyone have more input with regards to this. Below is my current structure.

Alternative App State structure

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda