createViewModel
Return a ViewModel.
If you want to initialization a ViewModel with parameters,just do like this:
override fun createViewModel(modelClass: Class<out ViewModel>): ViewModel {
return MainSharedVM("MyVM")
}
Content copied to clipboard
Return
the ViewModel of the Activity or Fragment.
Parameters
modelClass
by default, Activity or Fragment will get the ViewModel by modelClass.newInstance()
.