Hi, anyone with working example of KMP library mod...
# multiplatform
j
Hi, anyone with working example of KMP library module with swift code callable from kotlin ?
f
yes, it’s possible with spmforkmp.
j
Hi, thanks. I've seen this and it works for my small example. though I'd like to understand it and do it withou any extra plugins.
f
The plugin is a wrapper cinterop with extra features 🙂
j
I know, I read the document, but couldn't make it working by myself in terms of final linking, so I was trying to find some working example..
f
Calling swift code without external dependency is not a big issue when using .def file. but with some; it can be really complicate.
j
Yeah I couldnt figure out how to make it working in kmp library, If everything was part of the main project, it was fine..
f
I’m using the plugin inside a big project with multiple module with each one using spmforkmp (with external dependency), it’s working fine, sometimes I have some issue with the Gradle cache when updating the swift sources.
j
yeah I get it, it works for me as well.. though I'd like to still see & understanding what does it mean to do it manually... as android dev, whole xcode/ios build is for me very frustrating and almost everytime some unwanted xcode/macos update breaks something and this plugin is probably another candidate what might get broken with similar updates, so I'd like to know what's going on under the hood
f
It’s just like CocoaPods, the breaking change will be on the Kotlin side. But these kinds of plugin requires constant maintenance because build tools evolve everywhere.
And cocoapods is dying 🙂 and spmforkmp uses the embedded swift package manager .
if you don’t want to use a plugin; • build a xcframework like this • import it with cinterop • then import it on the xcode side (if needed)
j
are cocoapods anyhow involved at the stage of building KMP library ? I have it as shared -> iosApp bridge... but the KMP library itself doesn't need it does it ? (unless I bring extra 3rd party cocoalib into it)
exactly reason why I want to fully understand what it does, what makes me worry it's not official jetbrains plugin, so I might get into state it's broken and I have no way to make it working if I don't understand what it does
f
if you want to understand, try to reproduce the steps I just wrote, you have the basic
j
👍 thanks