https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
e

Emil Kantis

01/22/2021, 11:03 AM
Is it possible to have a single implementation used for both JVM and Native if all code I've written myself is platform-agnostic?
m

Marc Knaup

01/22/2021, 11:12 AM
If all code you write is “common code” then you can build it for both, JVM and Native. Additional code is only needed if you need to use platform-specific functionality.
e

Emil Kantis

01/22/2021, 11:28 AM
I had some issues with this, e.g. using
assert()
or
runBlocking {}
would create issues since they don't exist for all platforms (even though I'm just targeting JVM and Native, for which implementations exist)
m

Marc Knaup

01/22/2021, 11:30 AM
common
target only accepts code that is available on all potential platforms. Unfortunately there is currently no way to write common code that works on JVM and Native but not on others without using
actual
and
expect
.
e

Emil Kantis

01/22/2021, 11:32 AM
Ok, bummer. Thanks Marc 🙂
2 Views