lazyActivityViewModels
inline fun <VM : ViewModel> Fragment.lazyActivityViewModels(qualifier: Any? = null, noinline extrasProducer: () -> CreationExtras? = null): Lazy<VM>
Returns a Lazy delegate to access parent activity's ViewModel provided by Koject
class TopFragment : Fragment() {
private val viewModel: TopViewModel by lazyActivityViewModels()
}
Content copied to clipboard
Parameters
qualifier
Qualifier for identification.
extrasProducer
Create the default extras that will be used to create the ViewModel.