Is it possible to use Decompose for navigation bet...
# decompose
a
Is it possible to use Decompose for navigation between SwiftUI views ? I found this but I just cant use it in my swift codebase via my shared lib, is there a pod/spm package available ?
a
You have to copy-paste that file into your project. 😀
a
Is it that simple ? 🤔 I see the sample project directly depends on the decompose project like this
Copy code
api(project(":decompose"))
and that's the reason the Shared lib can expose classes like
ChildStack
Child
Value, MutableValue
right ? I was not able to import these directly
🥹 I can see DecomposeChild was available to be 🙂
a
Yeah, just export
decompose
and perhaps
lifecycle
modules to your framework
a
@Arkadii Ivanov I tried to export them but it fails with the following errr
Copy code
> Task :shared:linkPodDebugFrameworkIosSimulatorArm64 FAILED
error: Following dependencies exported in the podDebugFramework binary are not specified as API-dependencies of a corresponding source set:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:linkPodDebugFrameworkIosSimulatorArm64'.
> Following dependencies exported in the podDebugFramework binary are not specified as API-dependencies of a corresponding source set:
  
  Files: [/Users/anmolverma/.gradle/caches/modules-2/files-2.1/com.arkivanov.decompose/decompose-iossimulatorarm64/2.0.0-alpha-02/497f2c0d32d4b6d0a2c110f06adc430983c76e8a/decompose.klib]
  
  Please add them in the API-dependencies and rerun the build.
I have already specified my dependencies as api
Copy code
api(libs.decompose)                api(libs.essenty.lifecycle)
maybe something related to this
a
This looks similar to https://kotlinlang.slack.com/archives/C03H3N51SKT/p1681601170466479 Could you please try the solution from there?
a
nope, it's not the same I believe 🤔 also i am using the latest ones.
a
The YT ticket you mentioned looks unrelated, as it mentions another error? Could you please share your build.gradle file?
a
Copy code
essenty = "1.1.0"
decompose = "2.0.0-alpha-02"
decomposeExt = "2.0.0-compose-experimental-alpha-02"
a
Hm, are you using Compose for iOS or SwiftUI?
a
Both!
a
Ok, in this case could you please only use
2.0.0-compose-experimental-alpha-02
version?
a
by using that you mean to drop the decompose lib entirely and also exporting just experimental lib ?
a
No, you should use
com.arkivanov.decompose:2.0.0-compose-experimental-alpha-02
instead of
com.arkivanov.decompose:2.0.0-slpha-02
a
looks like gradle is happy because it's still building, let's see 🤞
It worked 🎉 👏
a
Yay! Glad that helped!
a
but can't import DefaultComponentContext now 🤔
wait, sorry, maybe i did something wrong
It works, thanks for your support 🙏
a
You are welcome!
171 Views