MVVM question here. There are times when you want ...
# android-architecture
u
MVVM question here. There are times when you want to clearly separate your logic by some kind of modulation. I mean, you usually have one
ViewModel
per
Fragment
or one per
Activity
, but suppose you have a
CustomView
, some complex UI panel (that is not a fragment) associated with some important business logic flow. What you may want in this case is some kind of (loose) dependency between your
CustomView
and your specific
ViewModel
, so that your
CustomView
observe
ViewModel
data. What would be your implementation here? I came up with the following solution: https://gist.github.com/uburoiubu/38608df08905d23e10ee919c430c6c34 What you do think? One may extrapolate this to the following question: what would be the best practice to connect a
CustomView
and a
ViewModel
? Thanks.