Created
July 28, 2022 08:47
-
-
Save ahmedMubarak2024/4ee7b734c60655e740f1de7af0f6855a to your computer and use it in GitHub Desktop.
simple view model factory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Suppress("UNCHECKED_CAST") | |
class TasksViewModelFactory (/*pass the pram you need*/ ) : ViewModelProvider.NewInstanceFactory() { | |
override fun <T : ViewModel> create(modelClass: Class<T>) = | |
(ViewModel(/*pass the pram to view model*/) as T) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment