I don’t know if my question weird, but is is possi...
# ios
m
I don’t know if my question weird, but is is possible to integrate a 3rd party library in Kotlin native (ex: Realm) and then use it as a common code for both iOS and Android?
k
You’d need to include the platform specific libs then write a bridge in multiplatform which you could call. Realm specifically does a lot of source gen and/or binary manipulation in Java, and would likely be a nightmare to use without the realm team creating a first-party multiplatform implementation.
Summary, Realm, no. Others, depends.
m
So in this case particularly, I need to move Realm outside multiplatform and use it for each platform like any usual project?
k
It’s kind of hard to explain. Realm doesn’t publish a “multiplatform” library, so each platform would need realm data object definitions. You could then define common classes to talk to realm classes, but because the realm data classes are likely to be slightly different on either platform, you’ll be adding a lot of “massage code” to get it into common.
If this is a new project, look at SQLDelight. That’s the TL;DR version. To use Realm you’ll need to do a lot of data translation (probably)
m
I see, actually its not a new project, I have been working on it since 2016. Thanks a lot for clarifying to me those points