Pablichjenkov
06/13/2024, 4:40 AMkoinCore = "3.6.0-Beta4"
koinAnnotations = "1.3.1"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.21"
using KMP?Pablichjenkov
06/13/2024, 4:40 AMdefaultModule
or any other module.Pedro Francisco de Sousa Neto
06/13/2024, 12:39 PMkoin = "3.5.6"
koin-annotations-bom = "1.3.0"
ksp = "1.9.22-1.0.17"
kotlin = "1.9.22"
Pablichjenkov
06/13/2024, 1:18 PMhectoruiz
06/13/2024, 1:56 PMksp = "2.0.0-1.0.21"
koin-bom = "3.6.0-alpha3"
koinVM = "1.2.0-Beta4"
kotlin = "2.0.0"
Pablichjenkov
06/13/2024, 3:17 PMPablichjenkov
06/13/2024, 7:05 PMadd("kspJvm", "io.insert-koin:koin-ksp-compiler:1.3.1")
Now it generates the Default.kt file but uses:
import org.koin.androidx.viewmodel.dsl.viewModel
and the compiler complains about not finding above import.
I am running the JVM target if if it helps.
Also using this:
@KoinViewModel
class AnnotationTestViewModel : androidx.lifecycle.ViewModel()
Pablichjenkov
06/14/2024, 4:07 AM@KoinViewModel
The moment I use above annotation, the genrated files don’t compile. The reason is, the generator creates an import of:
import org.koin.androidx.viewmodel.dsl.viewModel
and it should be:
import org.koin.compose.viewmodel.dsl.viewModel
Which is the kmp ViewModel importblakelee
06/15/2024, 5:43 PMtasks.withType<KotlinCompilationTask<*>>().configureEach {
if (name != "kspCommonMainKotlinMetadata") {
dependsOn("kspCommonMainKotlinMetadata")
}
}
ksp {
arg("KOIN_CONFIG_CHECK", "true")
}
dependencies {
add("kspCommonMainMetadata", libs.koin.ksp.compiler)
}
kotlin {
sourceSets {
commonMain {
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
dependencies {
implementation(project.dependencies.platform(libs.koin.bom))
implementation(project.dependencies.platform(libs.koin.annotations.bom))
implementation(libs.koin.core)
implementation(libs.koin.compose)
implementation(libs.koin.annotations)
}
}
}
}
Pablichjenkov
06/15/2024, 7:35 PMPablichjenkov
06/16/2024, 2:31 AMimplementation(libs.koin.compose.viewmodel)
// catalog
koin-compose-viewmodel = { module = "io.insert-koin:koin-compose-viewmodel", version.ref = "koinComposeMultiplatform" }
Not sure if that module is bringing a bad transitive dependency or something.
The error as I said before is that the generated code uses function:
import org.koin.androidx.viewmodel.dsl.viewModel
and not function
import org.koin.compose.viewmodel.dsl.viewModel