Created
June 29, 2019 17:49
-
-
Save jeremyrempel/6d23f51fd70b71e044741f826b5d7c56 to your computer and use it in GitHub Desktop.
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
class MyViewModelFactory @Inject constructor( | |
private val mainFragModel: Provider<MainFragmentViewModel> | |
) : ViewModelProvider.Factory { | |
override fun <T : ViewModel> create(modelClass: Class<T>): T { | |
return when (modelClass) { | |
MainFragmentViewModel::class.java -> mainFragModel.get() | |
else -> TODO("Missing viewModel $modelClass") | |
} as T | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment