I'm trying to follow Google's clean architecture guidelines.
I have a navigation subgraph with multiple pages corresponding to stages of filling a form.
Each page has it's own viewModel.
On the last screen I need to send data from the form to app's data layer which sends it to server.
How should I share the form object between viewModels?
I see such options here:
- Create
Formmodel andFormRepositoryin app's data layer and inject it to viewModels. I don't like it because knowledge about form is not exclusive for feature module anymore and appears in data layer, though it is basically a UI state - Use one viewModel for all stages. I don't like it because some stages do some data retrieval and input validation that is not relevant for others.
- Create
FormHoldersingleton in feature module, that is injected to all VMs. I'm not sure about it because I'm trying to follow architecture guidelines.
What should I do?