commons/ui / com.vmadalin.commons.ui.extensions / androidx.fragment.app.Fragment / viewModel

viewModel

fun <VM : ViewModel> Fragment.viewModel(key: String? = null, factory: () -> VM): VM

Generic view model provider.

Parameters

key - The key to use to identify the ViewModel.

factory - Function creates a new instance of the ViewModel.

Return
A ViewModel that is an instance of the given type VM.

See Also

ViewModel