Support for platform iOS dependencies

Regarding to docs:

" The packages from platform libraries are available by default. No special link flags need to be specified to use them. Kotlin/Native compiler automatically detects which of the platform libraries have been accessed and automatically links the needed libraries.

On the other hand, the platform libs in the distribution are merely just wrappers and bindings to the native libraries. That means the native libraries themselves (.so, .a, .dylib, .dll etc) should be installed on the machine. "

But when I inspect list of Native iOS libs at Android Studio, I spot, that I don’t have some libs at Android Studio which are available in XCode and some functions from another libs are not available at KMP.

So, I would like to ask - how looks like ‘automatic detection’ for Native Libraries for MacOS/iOS? Why some libs/function are not available? Is it connected to lack of support for Swift code?


1 Like

So far as I understand the implementation of how Kotlin Multiplatform allows access to iOS Frameworks, as of the time of this writing (Feb 2024), KMM is only capable of integration with Objective-C APIs and not Swift APIs. Therefore, integration with KMM is limited to only what the Objective-C APIs support.

I wrote a blog post that discusses this at a high level and also responded to a user’s question on SO with some additional recommendations for how to navigate the Kotlin Framework code and what resources are most useful when integrating with these APIs. That said, given the limitation of this, I would only recommend using expect/actual in specific cases.

The Kotlin team has a YouTrack ticket open for tracking Swift interoperability that you may want to flag for updates.