Hi, Isn't this dependency supposed to work on iOS?...
# koin
s
Hi, Isn't this dependency supposed to work on iOS? koin-compose-viewmodel-navigation In the documentation it says its compatible with Android/Multiplatform app, but it doesn't compile for iOS when using the NavHostController
1
z
That looks like the correct dependency. Are you perhaps hitting this problem? https://kotlinlang.slack.com/archives/C0346LWVBJ4/p1747129487534689?thread_ts=1747129487.534689&cid=C0346LWVBJ4
s
Hi Márton, The error is in the androidx.navigation.compose dependency. You have not referenced that one in the previous message. And there is no newer that 2.9.0
Copy code
"_kfun:androidx.compose.animation.core#androidx_compose_animation_core_SeekableTransitionState$stableprop_getter$artificial(){}kotlin.Int", referenced from:
      _kfun:androidx.navigation.compose#NavHost(androidx.navigation.NavHostController;androidx.navigation.NavGraph;androidx.compose.ui.Modifier?;androidx.compose.ui.Alignment?;kotlin.Function1<androidx.compose.animation.AnimatedContentTransitionScope<androidx.navigation.NavBackStackEntry>,androidx.compose.animation.EnterTransition>?;kotlin.Function1<androidx.compose.animation.AnimatedContentTransitionScope<androidx.navigation.NavBackStackEntry>,androidx.compose.animation.ExitTransition>?;kotlin.Function1<androidx.compose.animation.AnimatedContentTransitionScope<androidx.navigation.NavBackStackEntry>,androidx.compose.animation.EnterTransition>?;kotlin.Function1<androidx.compose.animation.AnimatedContentTransitionScope<androidx.navigation.NavBackStackEntry>,androidx.compose.animation.ExitTransition>?;kotlin.Function1<androidx.compose.animation.AnimatedContentTransitionScope<androidx.navigation.NavBackStackEntry>,androidx.compose.animation.SizeTransform?>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){} in ComposeApp[2861](liborg.jetbrains.androidx.navigation:navigation-compose-cache.a.o)
  "_kfun:androidx.compose.runtime#androidx_compose_runtime_ProvidedValue$stableprop_getter$artificial(){}kotlin.Int", referenced from:
      _kfun:androidx.navigation.compose#LocalOwnersProvider__at__androidx.navigation.NavBackStackEntry(androidx.compose.runtime.saveable.SaveableStateHolder;kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int){} in ComposeApp[2861](liborg.jetbrains.androidx.navigation:navigation-compose-cache.a.o)
ld: symbol(s) not found for architecture arm64
I have to comment out libs.koin.compose.viewmodel.navigation and use org.jetbrains.androidx.navigation:navigation-compose 2.7.0-alpha
Copy code
kotlin.native.cacheKind=none
also works with the latest navigation-compose version Thanks
also why and how does the gradle flag solves this issue??
z
Sounds like you might have mismatching Compose Multiplatform and Navigation library versions. You can check this in the release notes. For example, if you're using the latest 1.8.1 release of CMP, then the corresponding navigation library version as listed in the Dependencies section is
2.9.0-beta02
.
With Koin, you should use
4.1.0-RC1
, which is the release candidate that targets CMP 1.8 and later
also why and how does the gradle flag solves this issue??
The details are in the YouTrack issue that's linked in the comment above. The important part is that adding this flag disables caching in native debug builds which is bad for build times, so make sure that you only add it temporarily, if there's no other solution for your build. But it's best not to add it at all if you can help it.
s
Awesome. Thanks for the guidance.
p
Thanks @zsmb
k
Is there a mapping between compose multiplatform version vs koin ?
z
You generally shouldn't need a mapping. The only breaking version change was around Compose Multiplatform 1.8, due to the bug mentioned above. If you're on 1.8 or later, use Koin 4.1.0-RC1 or later. On older CMP versions things should be more flexible.
👍 1