ViewModelDelegate
class ViewModelDelegate<VM : ViewModel>(key: String) : ReadOnlyProperty<Any?, VM>
Content copied to clipboard
Class to be used as a delegate to a ViewModel which can be stored and retrieved in a ViewModelStore.
Parameters
VM
The type of the view model being delegated.
key
Unique identifier for this ViewModel.
Constructors
Functions
Link copied to clipboard
fun <O : ViewModelStoreOwner, HasDefaultViewModelProviderFactory> initialize( viewModelStoreOwner: O, viewModelClass: KClass<VM>, factoryAvailable: Boolean)
Content copied to clipboard
Initialize the delegated view model by either restoring or storing it in the ViewModelStore of the ViewModelStoreOwner.