Tag Archives: Reified

What is Kotlin Reified Type Parameter?

What is Kotlin Reified Type Parameter?

One of the most common uses of this reified type parameter is view model creation. For example, the following code is the viewModels() composable helper function to create the view model. @Composable public inline fun reified VM : ViewModel> viewModel( viewModelStoreOwner: ViewModelStoreOwner = checkNotNull(LocalViewModelStoreOwner.current) { "No ViewModelStoreOwner was provided via LocalViewModelStoreOwner" }, key: String? = null, factory: ViewModelProvider.Factory? = null …

Read More »