Closed kyhule closed 5 years ago
@kyhule I guess you could do a when expression in accept(vm: TransportControlsViewModel)
, and pass only instances of Show
to your ModelWatcher
.
For the general case, when you have multiple data classes inside your ViewModel sealed class, you could have a ModelWatcher
instance tailored for each different type respectively.
Considering I have seen similar cases before, probably we can improve it from the library perspective as well. For now, please use the suggestion above :)
Thanks for the suggestions; I had not even considered multiple model watchers.
@kyhule Included in 1.2.4 :)
@shikasd Nice! I checked it out when you submitted a PR. I'll have to update it now and give it a try. Thanks again and awesome work as always 👍
We represent our view model as sealed classes a lot of times and was looking to leverage
ModelWatcher
but I'm struggling to come up with a good way to handle this. Take for example the following view model:My initial approach was to set to watch the entire model but that turned out not to be very helpful because, when shown, there is a new model emitted every second with the only property usually changing is
position
.Have you had to handle any similar scenario in your since implementing this?