injectActivityViewModels

inline fun <VM : ViewModel> Fragment.injectActivityViewModels(qualifier: Any? = null, noinline extrasProducer: () -> CreationExtras? = null): Lazy<VM>

Deprecated

Renamed to lazyActivityViewModels.

Replace with

this.lazyActivityViewModels(qualifier, extrasProducer)

Returns a Lazy delegate to access parent activity's ViewModel provided by Koject

class TopFragment : Fragment() {
private val viewModel: TopViewModel by injectActivityViewModels()
}

Parameters

qualifier

Qualifier for identification.

extrasProducer

Create the default extras that will be used to create the ViewModel.