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
kpgalligan
03/21/2019, 11:00 PM
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.
kpgalligan
03/21/2019, 11:00 PM
Summary, Realm, no. Others, depends.
m
Mohammadsss1
03/21/2019, 11:24 PM
So in this case particularly, I need to move Realm outside multiplatform and use it for each platform like any usual project?
k
kpgalligan
03/21/2019, 11:27 PM
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.
kpgalligan
03/21/2019, 11:28 PM
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
Mohammadsss1
03/21/2019, 11:31 PM
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