I have a function with kotlin and i like to call specific platform code from there.
Is possible to import both platform libraries? I need a conditional to check which platform is running?
o
olonho
11/23/2018, 1:58 PM
it is possible using multiplatform (MPP), doing it from the same file is not possible
n
Nikky
11/23/2018, 3:46 PM
expect and actual ?
d
danielbahe
11/23/2018, 3:54 PM
let me show an example
var miau = "whatever"
// here db is a specific platform
i want to know how to be able to give the correct one
db.insert(miau)
// continues common code
s
Sam
11/24/2018, 3:36 AM
Definitely read up on multiplatform. Basically you'll create a project of common code and then a number of source sets for each specific platform. Those source sets will have platform specific dependencies. The common code can depend on classes defined in platform source sets by using the expect/actual mechanism to create stubs and implementations.