I have a big viewModel for one screen, should i sp...
# compose
g
I have a big viewModel for one screen, should i split them into more ViewModels? Or keep leaving a ViewModel for each screen?
s
how big are we talking here?
m
I suggest that you can try to implement use cases and you can take a look at the MVI pattern
o
Let’s keep this channel focused on Compose.
g
405 lines
i have uses case for set and get data, should I implement uses case for all viewModel functions?
m
it depends, if you can separate every functionality into use case that would be great but sometimes, I feel the use cases is overkill, as they just mapping to data layer with no extra logic so I suggest you check the MVI + MVVM pattern
g
Copy code
Yes, I use the vmmv pattern already, and quite a few use cases to call the repositories, I call the repositories directly from the VM because the use cases don't do anything, I've only left one use case because I need to make modifications before bring the data.
m
try MVI then it will eliminate all the states you already defined in your view model and it will be one state class for your screen holding all the required info you need and an event class for the actions and you can map them in the view model I think this way it could be cleaner and easier and centralised
g
I don't know anything about MVI, why not MVVM?
m
with MVVM
but your case that you have God view model