Hello, I am testing out some local swift packages ...
# multiplatform
a
Hello, I am testing out some local swift packages in my project and trying to link them to my shared kmp module
my project structure looks like this
I am just testing out but I noticed something i would like to get some more information on
as you can see i created some local packages and imported them into my ios app
The idea is that if i work from both Fleet and Xcode at the same time, Xcode has a very hard time of finding the links to my swift packages and their respective libraries
Now i wonder when my Xcode throws me something like "cant find your shared module"
what works for me is removing the frameworks and building, then re add them again into my project
Any idea on how to fix this? unless i remove the frameworks and build, and re add after building i cant build my project
this is quite annoying
p
I very often do what you do or: File/Packages/(reset,resolve or update)
a
So there is no actual workaround as of now
still the ability to feed the shared module to these packages and their libs is quite amazing
a good tradeoff
p
Yeah is amazing. To feed it, I use 2 options. For development I just import ComposeApp.framework directly and use embeddAndSign... gradle task. Once I am ready to a release I export an Xcframework and do the integration below. For a project that just uses the shared module as an Xcframework, then I use in each dependent package:
binaryTarget(url or local-path to my Xcframework)
Ah forgot to mention, wrt your original question, sometimes clean project and restart Xcode works for me too
Seem like is a cache Xcode thing.
a
From what i noticed, If both fleet and xcode are running they dont stay in sync, a cache thing like you said
only running from xcode works
running other targets will break xcode build
p
Ah I missed that detail, I am on Android Studio not Fleet
a
@Pablichjenkov unrelated to to this, maybe related but have you had trouble sharing resources into the ios packages?
Just now i managed to feed fonts into the ios app swift ui
but im still crashing when navigation to compose views
p
I have played with
composeResources
(not resources) and is being good so far. This is all in compose side. You seem to refer to resources load in swift side right? Also
composeResources
multimodule support is pretty fresh. You will have to use kotlin 2.0+ and the latest composeResources plugin
a
Yes I am using kotlin 2.0 and i know it just left experimental
The idea is i ran into this issue here
I am not quite sure if there is a way to do this but i did manage to link my font files from the resource common folder of my design system module to my ios app
without duplicating files
But i am wondering what happens for images or other type of resources
p
I see. I think Konstantin has explained this situation before. When the XcFramework is integrated in the build where the KMP plugin is applied and different Gradle iOS assemble/embed tasks are present. Then the compose resource plugin copy the resources to iOS project accordingly. However, when you consume the XcFramework in a pure iOS Xcode project, (without the KMP/resources plugin). There is not a way to copy resources from the XcFramework. Apple hasn't defined any standard in respect. Xcode doesn't have a specific layout and rules defined. Each build tool does it independently. Cocoapods do their way, and SPM or cartridge their own way. I think JB is working on improving this experience but not sure of the current status
a
Yes 😞 I am not sure how to do the workaround though
I will leave a comment on the issue
💯 1