Created
April 14, 2020 13:20
-
-
Save erdemtopak/9584d1af2dec0829f0991325ddb469ae to your computer and use it in GitHub Desktop.
Create ViewModelFactory
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
fun createViewModelFactory(viewModel: ViewModel): ViewModelProvider.Factory { | |
return object : ViewModelProvider.Factory { | |
@Suppress("UNCHECKED_CAST") | |
override fun <T : ViewModel?> create(modelClass: Class<T>): T = viewModel as T | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment