Are all cocoapods dependencies supposed to work in...
# multiplatform
b
Are all cocoapods dependencies supposed to work in KMP? For example AFNetworking works and its .knm file is generated. But when I add some other random dependency, its .knm file is completely empty
l
Hello! Please, provide at least one example of "other random dependency" where it doesn't work the way you expect.
b
@louiscad For example
SnapKit
works, and I can use its functions. But
pod("VecoreSDK", moduleName = "VecoreSDKFramework")
does not work correctly, since I can't use the library
1_SnapKit.knm
has cinterop code and
0_VecoreSDKFramework.knm
is empty
l
Isn't it a Swift-only library that is not exported to Objective-C, and therefore, not visible to Kotlin/Native?
b
How can I find out its its swift-only?
And if it is, is there no fix for it?
l
@Berkan If it's 100% Swift and there's no
@objc
annotation, it's not Obj-C compatible. One solution is to fork the library to add that interop capability.
b
This library doesn't seem te be opensource, can I maybe make some kind of wrapper file with obj-c that calls the swift functions?
l
Yep, you can try a Swift wrapper that is exported to Obj-C.
b
Do you know if theres any guide for this? I have limited knowledge of iOS, I'm mainly android/kotlin developer.
l
You can definitely Google how to make a Swift library, and then, it's as simple as adding the
@objc
annotations, and publishing your library (which is simpler than publishing Android/Kotlin libraries at the moment, GitHub is all you need).
b
Wouldn't I have to create an obj-c framework in this case? instead of a swift library
l
It's kinda both
b
Thank you for your help so far. Do you perhaps know of some example of this?
l
I'd Google it, but that's something you can as well 😉
b
I actually was able to download the .framework file of this library. Does this open up some other possibilities to make it work?
l
You don't need that. You just need to declare the dependency on it in your Swift library
b
Ah, through pods or manually?
Just to be sure, would I have to create a swift package, framework or static library?
l
Framework that you publish with Cocoapods
👍 1
b
I think I figured out how to make this framework. Do you know if its possible to upload this framework as a private pod and still use it in Kotlin in build.gradle.kts?
l
I'm 99% certain it's possible. I think a private git repo will work so long as you have ssh configured on your machine to access it.
b
Hi @louiscad. Do you happen to know if I can just use this wrapper framework i created as-is? So not calling it through a pod() dependency in build.gradle
l
@Berkan I don't think so, though that may change at some point. That said, you should be able to use a local pod, that can be located into your git project.
b
How can I point KMP to look for the pod spec in my git repo?
l
I don't know from the top of my head, but I'm pretty sure you'll find the info in the Kotlin docs, Cocoapods docs or by simply searching on Google with the right keywords.