Created
June 24, 2019 19:40
-
-
Save Rasalexman/dd8b9781a4bf554555ba9547b41d09f3 to your computer and use it in GitHub Desktop.
This file contains 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 ViewModelFactory(appContext:Context) : ViewModelProvider.Factory, KodeinAware { | |
override val kodein: Kodein = (appContext as MainApplication).kodein // we can use `by kodein(appContext)` also | |
override fun <T : ViewModel> create(modelClass: Class<T>): T = kodein.direct.Instance(TT(modelClass)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment