createViewModelScope

inline fun <VM : ViewModel> ComponentActivity.createViewModelScope(extraKey: String? = null, noinline extrasProducer: () -> CreationExtras? = null, noinline factoryProducer: () -> ViewModelProvider.Factory? = null): Lazy<VM>


inline fun <VM : ViewModel> Fragment.createViewModelScope(extraKey: String? = null, noinline extrasProducer: () -> CreationExtras? = null, noinline factoryProducer: () -> ViewModelProvider.Factory? = null): Lazy<VM>

Creates a ViewModel with the given owner (default is this@Fragment) and registers it.

Any ChildFragment can use scopedViewModel or scopedInterface to retrieve it.