is ViewModel available for desktop? seems like its...
# compose-desktop
g
is ViewModel available for desktop? seems like its only adroidx
1
a
I think it's not.
g
😞
a
Why would one need it for desktop?
g
we're going around in circles mate
j
you can just do expect actual
m
There was a recent discussion about how
ViewModel
is not strictly necessary in a pure-Compose world even on Android: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1608859219262500 The point of the Jetpack
ViewModel
was to deal with configuration changes. AFAIK, Compose for Desktop does not have such a thing.
c
Good point. In android lang you can still use a ViewModel and just not use the Android Arch ViewModel if you want to. Seems like AAC ViewModel was mostly a convenience/band-aid to the issues people had with activity/fragment lifecycle. Not an expert on these things... just stating my point of view. I think the creator of ViewModel even admitted ViewModel is kind of a bad name because it's not even necessarily a ViewModel. Anyway, yeah the biggest reason ViewModel in android is popular is because it smooths out the lifecycle events in android.
👆 3