Created
April 28, 2020 19:55
-
-
Save lamvann/64b78aeeb67f61bc28a936d8c0579d2c to your computer and use it in GitHub Desktop.
Adding viewModel property to BaseFragment using Koin with reflection
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
private val viewModelClass = | |
(javaClass | |
.genericSuperclass as ParameterizedType) | |
.actualTypeArguments[0] as Class<ViewModelType> | |
val viewModel: ViewModelType by lazy { getViewModel(clazz = viewModelClass.kotlin) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment