Zhuinden / realm-monarchy

[ACTIVE-ISH] A wrapper over Realm which exposes it as LiveData, managing Realm lifecycle internally.
Apache License 2.0
88 stars 11 forks source link

Suggestion: ViewModel support #29

Closed gelbertgel closed 4 years ago

gelbertgel commented 4 years ago

You have LiveData, Observers but you don't have technological ViewModel. Activities layout didn't update realtime. Please add viewmodel support

Zhuinden commented 4 years ago

Technically there is no difference to the current code other than that the LiveData<*> would be stored inside a ViewModel, rather than in the Fragment (as it is currently in the samples).

Monarchy doesn't need to change anything to have its LiveData be stored inside a ViewModel.

Activities layout didn't update realtime.

It should, if the observer is active. Is there anything more to know about this issue?

gelbertgel commented 4 years ago

Ok thank you please add example for ViewModel in your code:)

Zhuinden commented 4 years ago

This is technically already supported, adding VMs to the samples isn't particularly tricky. If anyone feels like it, it can be done, although if the samples were updated to Kotlin it'd be even easier with by viewModels() and whatnot.