Hi, i can not find in google anything about how to...
# multiplatform
s
Hi, i can not find in google anything about how to combine platform-specific libraries in KMP. its the same scenario like https://github.com/touchlab/CrashKiOS - this library combines Crashlytics IOS lib for IOS target and Crashlytics AN for Android.
k
I don't think you'll find a ton out there, and it depends on what you want to figure out. Mechanical setup? Common API design? I gave a talk called "Bridging the API Gap", or something similar to that. The title on the page and video title are wrong (I gave that talk a few weeks later at Droidcon Berlin), but the content is correct: https://www.droidcon.com/2022/06/28/sdk-design-and-publishing-for-kotlin-multiplatform-mobile/
👍 1
(I wrote CrashKiOS, BTW)
👏 2
For API design, some considerations. Is this just for internal use or as a published API? If internal, it's easier to figure out the subset you're really interested in, assuming it's not the whole API. Also, you can generally get by with "functional" rather than "elegant". If this is intended to be a public thing, there's maybe more work required for API design. CrashKiOS makes no effort to cover the whole API of each. Features have been added as they're requested.
For mechanical, Android is usually much easier, as you're directly participating in the Gradle/Maven dependency system. iOS can be tough. In the case of CrashKiOS, Crashlytics and Bugsnag will be added to the iOS app by the iOS team, so you don't want to specify a hard dependency in the Kotlin code. However, when you're building Kotlin, the build will want to link to the binaries. Still need to find a good general solution.
i
I’ve found this article to be helpful. It will help create a bridge as Kevin mentioned https://medium.com/@mofeejegi/calling-platform-specific-dependencies-in-kotlin-multiplatform-69dbc9a841a2
👍 1
s
Thank you guys. Gonna take a look at both links provided
i
also, if the pod name has hyphens, cocoapod will act up, solution is to find the module name: https://newsroom.shadowfax.in/unable-to-import-ios-library-in-kmp-via-cocoapods-try-this-ec0d960f464c