Anyone know of a kmp "nearby" library? I'd like to...
# multiplatform
c
Anyone know of a kmp "nearby" library? I'd like to send messages back and forth to my ios device from my android device without being on the same wifi network.
e
I think Google has a nearby SDK for both Android and iOS. Probably not KMP, but should be able to be wrapped easily enough.
c
thanks... still new to kmp so "wrapping" those libraries sounds a bit scary. but probably isn't. lmaoo
e
In theory it's pretty simple. Define the common interface you want to use and then write expect/actuals to provide the implementation for it. In practice, it depends 😅
💯 6
j
It makes it easier if the library APIs are well aligned between the two platforms. Usually the Kotlin/Java library's API can be mirrored in the wrapper API, and often typealiased directly. Then the native platform's API might need some type conversions done in the wrapper to convert between Kotlin and native types.
👍 3
👍🏾 1
My library, Kotbase, does this for the Couchbase Lite database, if you want an example.
m
I wrote a simple article that covers "wrapping" here in case you want to attempt it.
👆 3
c
thanks all. this should def help. cheers
l
Let us know how it goes!