Hello all, I was very happy that my project did r...
# decompose
f
Hello all, I was very happy that my project did run on android. But when I tried to run the project on iOS it failed 😞 . I tested it with adding and deleting out the decompose dependencies in my clean branch and it failed running iOS when adding those dependencies and succeeded when commenting them out. I am not sure that this is the issue but if somebody could help me out here it would be wunderfull. I have made the repo public. https://github.com/MaykaSoftware/Talamyd/tree/decompose any help would be great. I spend the whole weekend trying stuff but unfortunately nothing worked.
a
Is it a runtime crash or a build failure? Is there an error message or a stack trace?
f
I get this log. Don’t really understand what is means
a
Can you try making
extensions-compose-jetbrains
implementation
, not
api
?
f
Doesn’t change. Build still fails
a
Can you share more of the error?
The first screenshot is cut at the top
Oh, your Essenty version is pretty low. Try upgrading Decompose to 2.0.0 and Essenty to 1.1.0
And don't make extensions compose
api
, it could be
implementation
f
ok i will try
a
Also, you have extensions-compose-jetbrains in common, but no Compose?
1
f
Ah yeah haha. I did delete extensions-compose-jetbrains for now and it works.
Next step is to add these classes manually?
f
Thanks you very much once again 🌹
a
You are welcome! Glad your problem was solved.
f
Sorry Arkadii, here I am again. A couple of things. I have added the helper classes in my android studio and they were not visible in XCode while they were present in my folder when I opened it in my finder. After that I added the classes manually in XCode itself. But I have issues with the Value classes. I must be doing something wrong. I am not using KMMBridge by the way
Schermafbeelding 2023-07-25 om 20.30.04.png
a
Exporting
decompose
should make those classes visible from Xcode. Please try building the Xcode project. The build should fail but it should make the classes available.
f
Unfortunately it keeps failing the build and not recognize the import.
a
Perhaps something related to gradle? You can try adding your own class to Shared framework, then build Xcode, and see if it's available.
f
It might has to do something with this. In your decompose lib you are not using the listOf and in the confetti app they are not filtering based on it.konanTarget. I will research how to change this properly
Copy code
targets
        .filterIsInstance<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>()
        .filter { it.konanTarget.family == org.jetbrains.kotlin.konan.target.Family.IOS }
        .forEach {
            it.binaries.framework {
                baseName = "Shared"
                export(libs.decompose)
                export(libs.essenty)
                export(libs.reaktive)
            }
        }

    listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.binaries.framework {
            baseName = "shared"
        }
    }
a
You are setting the framework name twice with different names. Maybe that's the reason.
Oh, try moving target definitions above exporting!
f
That doens’t work
a
Now you are exporting twice 🙂
I mean that targets should be defined before exporting, not after.
f
I deleted the targets and I get code completion in xcode but it keeps showing Error and the weird thing is I can see the classes in local changes but not in folder structure
I think I have to talk with my iOS college tomorrow. Because I am not an iOS developer
a
There is no
val
in Swift, did you mean
let
?
f
i meant var sorry my bad
The xcode ide also changes the SignUpUiState model i have in kotlin in SignupComponentSignUpUiState haha
it concatonates the class and model
a
Yeah. Either put the model top-level, or inside but name it just Model
f
You are correct it was inside my interface. I will move it up. So xcode knows my class are there but it keeps failing because of unknown attribute ObservableObject and ObservableValue. I will add the swift files in xcode manually and see what happens
a
Yes, you have to add those files manually
f
I give up for today. it’s been a long day. Thanks for all the help once again. I will continue tomorrow
a
The doc says iOS 13.0+, what's your target iOS version?
And it appears that you are looking at outdated sample? Check out the latest: https://github.com/arkivanov/Decompose/blob/master/sample/app-ios/app-ios/CounterView.swift
The old way (what you are trying to do): annotate properties of type
ObservableValue
with
@ObservedObject
(not
@ObservableObject
). The new way: add
StateValue
property wrapper to your project and use it instead.
f
Ah thanks. I will look into it when I get back home. I went outside for a walk. Get some fresh air haha
a
Doing the same now 😁
👍 1
f
Alrighty then. It works 😃. Thnx Arkadii. Tomorrow I will start iOS-ing.
🍏 1