I’m a bit lost with my K/N setup. My goal: to crea...
# kotlin-native
g
I’m a bit lost with my K/N setup. My goal: to create a tiny project that targets JVM, JS, iOS, macOS and Windows, but shares the vast majority of the code (ie. a cross-platform library). I’m particularly stuck on iOS / macOS / Windows as none of the samples I have found actually reuse code from a
common
module. I’m also assuming that the whole
expect
/
actual
workflow wouldn’t work here, and that
stdlib
wouldn’t be available. Is this possible?
o
Yes, it is possible, stdlib (in its common part) is shared between JVM JS and Native backends. Please note, that common modules are just a handy tool to organize cross-platform development. It's being improved, but even now nothing prevents you from writing shared code, and compiling it differently to different platforms.
g
So I can just add the
common
dependency to eg. the iOS module, implement the missing classes / methods (
expect
/
actual
) and and it’ll work? Interesting, hadn’t thought of that or seen it anywhere. Will try it out later today, thanks! 🙂
o
sure, nothing would prevent you from doing that, just remember using different compiler for native vs JVM targets