injectViewModels
inline fun <VM : ViewModel> ComponentActivity.injectViewModels(qualifier: Any? = null, noinline extrasProducer: () -> CreationExtras? = null): Lazy<VM>
Deprecated
Renamed to lazyViewModel.
Replace with
this.lazyViewModels(qualifier, extrasProducer)
Content copied to clipboard
Returns a Lazy delegate to access the Activity's ViewModel provided by Koject
class TopActivity : ComponentActivity() {
private val viewModel: TopViewModel by injectViewModels()
}
Content copied to clipboard
Parameters
qualifier
Qualifier for identification.
extrasProducer
Create the default extras that will be used to create the ViewModel.