can I get some better understanding on what viewModelFactory does please. ty
b
can I get some better understanding on what viewModelFactory does please. ty
๐Ÿ‘ 1
๐Ÿ˜ถ 1
v
ViewModelFactory it is a factory class that creates ViewModel objects and configure them so they can survive configuration changes. If you create your object like any other regular the ViewModel wonโ€™t be aware of the activity lifecycle, does that makes things a bit more clear?
https://developer.android.com/codelabs/kotlin-android-training-view-model#0 This might be a good exercise to dive deeper into ViewModel
m
Vmfactory males More isolated the instantiation of viewmodels, with things such as passing parameters and enhancing the Ui testing of the viewmodels ๐Ÿ‘