jonasb
06/27/2019, 12:17 PMby viewModels()
(part of Android KTX) requires a viewmodel factory provider as opposed to a viewmodel factory. I.e. I would prefer to be able to write val vm by viewModels { MyViewModel(arg1, arg2) }
. Is there anything I’m missing where making the viewmodel factory as explicit as it is now is of great benefit?pavi2410
07/02/2019, 5:47 PMval vm by viewModels { MyViewModel(arg1, arg2) }
MyViewModel(arg1, arg2)
would create a new object otherwise, which should be created using ViewModelProviders.
I would rather require them to be like
val vm by viewModels<MyViewModel>(arg1, arg2)