Currently, I am working on a project where
ViewModel classes exposes
LiveData objects for Fragments and Activities.
For a simple layout, it is easy to expose one or two LiveData objects from ViewModel to Activities.
But for a complex layout and conditions, there are some cases where my ViewModel class contains more than 10 LiveData objects for different UI state.
For example, consider following LiveData objects,
val loading: LiveData<Boolean>
val noData: LiveData<Boolean>
val users: LiveData<List<User>>
val timer: LiveData<Long>
val userSelectedImage: LiveData<String>
and so on…
So in these type of scenarios, do you recommend any proper way to provide states from ViewModel to Activities or Fragments?
It would be helpful if you can guide me in the right direction or provide me some links to read for myself.