Hi, does someone have any official or good guide l...
# compose-desktop
p
Hi, does someone have any official or good guide link about how to use MVVM (ViewModel) in compose-desktop? Thank you.
m
I use Voyager's ScreenModel for MVVM with Voyager navigation https://voyager.adriel.cafe/screenmodel
p
Hi @Mitchell Syer thanks. So doesn't exists an official way? just third party ones?
m
ViewModel from google was made specifically for Android using Android specific APIs, so we do have to use our own implementations or ones from third party libraries
p
OK understood
e
It's worth noting that you don't strictly need Android ViewModel to follow the MVVM architecture. The ViewModel is just a regular with a special role in MVVM.
One more thing: The idea of MVVM is that changing the view system should not mean you need to change how you implement M and VM in MVVM. Which is very much true for Android. The only new part is understanding how to map the view binder and View of MVVM. If you look at examples from the official doc they have a concept of
Screen
and
Content
.
Screen
serves the purpose of a view binder and
Content
is the top-most view.
c
examples from the official doc
What doc are you reffering to @enighma? android docs, mvvm docs, or voyager docs, or somethin else?
e
Android and Jetpack compose docs. I don't think there are any official mvvm docs. The closest is probably some from Microsoft but they are usually tailored to XAML.