Skip to content Skip to sidebar Skip to footer

Kotlinoptions In Kotlin Multiplatform Project

I am trying to use the Android dependency androidx.fragment:fragment-ktx:1.2.2 to be able to load ViewModels in fragments but I am getting an error when trying to use viewModels()

Solution 1:

Ended up I my imports were wrong, I needed import

import org.koin.androidx.viewmodel.ext.android.viewModel

then all I had to do was

val viewModel: MyViewModel byviewModel<MyViewModel>()

Post a Comment for "Kotlinoptions In Kotlin Multiplatform Project"