If i add a framework without CocoaPods to my KMP l...
# multiplatform
g
If i add a framework without CocoaPods to my KMP library, and then publish my KMP library to mavenLocal, will i be able to use this library? Will the framework binaries be packaged inside the maven repository?
j
The framework is not packaged in the publication. You need to be sure to link the framework in the code consuming the library. I'm doing this in this example in my library. This library might be able to do what you're describing. But note it's not actively supported.
v
But this beats the purpose. I want to distribute my kmp library with dependencies
j
Native frameworks aren't distributed the same as Java libraries. The CocoaPods plugin helps facilitate generating a podspec to provide this dependency propagation between Kotlin and iOS native code. But this needs to be done at the shared Kotlin module layer that is consuming your KMP library. Perhaps there could be a way for Kotlin to package the CocoaPods dependency info as metadata in the .klib format for KMP library consumers. But this doesn't work this way currently.
v
So basically there is currently no way to actually use swift / objc code in kotlin multiplatform library in a way that it will be packaged inside the library?
j
As I mentioned above, this library was built to accomplish this. I haven't used it, and it's not actively supported.
v
Yes. I saw that. Didn't want to use it as its not actively supported. But I must be missing something. How else can i create a kmp library that uses some native code if i can't package it? It's a major limitation.
j
I created a KMP library that does just that. I provide examples and document how to set up consuming projects to link the proper dependencies.
c
How do you expect it to work? Ship the sources of the native library as part of the publication? Ship a dynamic library for each architecture as part of the publication?
v
@Jeff Lockhart Thanks, I tried your approach, it seems to work. Not ideal, but for the lack of other alternatives, it will have to do for now. Thanks again.
👍 1
218 Views