Has anyone tried the (apparently newly introduced ...
# multiplatform
m
Has anyone tried the (apparently newly introduced in Kotlin 2.0) local spm embedding of kmp packages? https://kotlinlang.org/docs/multiplatform-spm-local-integration.html The tutorial didn't work for me unfortunately and I was wondering if it's me or the tutorial, because it seems to be missing some important information
p
I do recall it worked for me. What problem are you having?
m
The shared module is unresolved in the local package. What's weird is that there's no mention of its Package.swift. I'm not sure how it's supposed to be properly embedded, why the embedding is in the pre action of app and not the spm package, why the import is Shared, not the usual shared and things like that
p
Humm, I am able to see the “shared” framework from the swift package code. This is the project, you can check. I named the shared framework “ComposeApp” in my case. https://github.com/pablichjenkov/macao-marketplace Pretty much check that you have that same project structure. I actually went over the documentation page and tend to agree that is missing something.
m
Thanks! I'll check that out
You also don't seem to have the pre-action script at all - for the swift package or the app
p
Well, that line pulls another Swift Package that I am using. The other Swift Package development project I have it locally, I haven't published it on GitHub. Uses Xcframework with binaryTarget in the Package.swift but that compiles slower than the direct SPM integration.
How do you check the preaction, if I have it or not? In the
project.xcodeproj
? I just checked and I have it there.
🤔 1
m
okay, so this seems to be a bit different thatn what the tutorial shows with a pre-action script that runs embedAndSign and then automagically the local spm package has reference to the shared module? Yes, I checked there. I am on the dev branch
p
Check under
Build
tab, in the screenshot
Run
is the tab selected.
m
I have no idea why, but nothing there either
damn, I think those might not be commited to the repository. Just changed some in my project and nothing changes in the git staging 🤯
p
Me neither TBH. I am not sure if I am pushing all Xcode configurations to the repo. I might have mistakenly gitignored some config files. But I can confirm on my local I have the same as in the documentation.
a
Following up on this conversation, I am also using this approach for preActions on the build for the scheme like mentioned here https://kotlinlang.org/docs/multiplatform-spm-local-integration.html . the build is successful, but the app fails to run with the following error, I wonder what causes
No code signature found.
Copy code
Domain: IDEInstallLocalMacService
Code: 14
Failure Reason: This app cannot be installed because its integrity could not be verified.
Recovery Suggestion: Failed to verify code signature of /var/db/appinstalld/Library/Caches/com.apple.mobile.installd.staging/temp.GyL59B/extracted/nofirebasedev.app/Frameworks/MyFramework.framework : 0xe800801c (No code signature found.)
hmm, so i had to run embedAndSignAppleFrameworkForXcode twice, once in preAction and once again in build phases.
👀 1
p
Interesting, I don't recall if I did this as well. I actually ended up using direct framework integration, compilation where faster. And changes propagated faster.
a
I have a large/complicated build system, To avoid sharing the full SharedLib with the SwiftUI DesignSystem SPM I had to created a separate DesignDystemSpec kmp library(used by both android, iOS) so I had to add this to my usual build phases too as well as preAction which magically provided the framework to the SPM 🤷 but it works.
👍 1