Error compile in ios
Veyogar library version 1.0.1 koin version : 3.5.3 org.jetbrains.kotlin.multiplatform: 2.1.0 org.jetbrains.compose: 1.7.3
Error occurred while optimizing an expression:
CALL 'public abstract fun <set-value> (<set-?>: T of kotlinx.coroutines.flow.MutableStateFlow): kotlin.Unit declared in kotlinx.coroutines.flow.MutableStateFlow' type=kotlin.Unit origin=EQ
$this: CALL 'internal final fun <get-lastScreenModelKey> (): kotlinx.coroutines.flow.MutableStateFlow<kotlin.String?{ cafe.adriel.voyager.core.model.ScreenModelKey? }> declared in cafe.adriel.voyager.core.model.ScreenModelStore' type=kotlinx.coroutines.flow.MutableStateFlow<kotlin.String?{ cafe.adriel.voyager.core.model.ScreenModelKey? }> origin=GET_PROPERTY
$this: GET_VAR 'val this: cafe.adriel.voyager.core.model.ScreenModelStore [val] declared in cafe.adriel.voyager.koin.getScreenModel' type=cafe.adriel.voyager.core.model.ScreenModelStore origin=null
<set-?>: GET_VAR 'val key: kotlin.String{ cafe.adriel.voyager.core.model.ScreenModelKey } [val] declared in cafe.adriel.voyager.koin.getScreenModel' type=kotlin.String{ cafe.adriel.voyager.core.model.ScreenModelKey } origin=null
Update voyager version and refer to this 515
@zeeshanali-k not fix the issue
https://github.com/adrielcafe/voyager/issues/522#issuecomment-2670438959
@Farhod-Tohirov could u please share the solution
@Farhod-Tohirov could u please share the solution
I just added rinku to that project )
kotlin = "2.1.0" ksp = "2.1.0-1.0.29" compose-plugin = "1.7.1" rinku = "1.3.2"
class KMPConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
... // other code
val kmpExtension = extensions.getByType<KotlinMultiplatformExtension>()
configureKMPTargets(kmpExtension)
with(kmpExtension) {
sourceSets {
commonMain.dependencies {
api(libs.findLibrary("rinku").get())
implementation(libs.findLibrary("rinku.compose.ext").get())
}
}
}
... // other code
}
}
}
internal fun Project.configureKMPTargets(extensions: KotlinMultiplatformExtension) =
with(extensions) {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_2_1)
}
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = [email protected]()
isStatic = true
export(libs.findLibrary("rinku").get())
}
}
}
private fun Project.resolveFullName(): String {
val nonRootParent = parent?.takeIf { it != rootProject } ?: return name
return "${nonRootParent.resolveFullName()}_name"
}
internal fun KotlinMultiplatformExtension.sourceSets(
configure: NamedDomainObjectContainer<KotlinSourceSet>.() -> Unit
) {
(this as ExtensionAware).extensions.configure("sourceSets", configure)
}
Apply KMPConvention plugin
he fix was bizarre but surprisingly effective—adding rinku as a dependency resolved Voyager’s iOS issues, likely by bridging a gap in Kotlin/Native interop or threading. Shoutout to @Farhod-Tohirov for the unconventional save!
iosMain {
dependencies {
implementation(libs.ktor.client.darwin)
implementation(libs.stately.common)
implementation("dev.theolm:rinku:1.3.2") // "WTF fix" that actually worked
}
}