Even though I’m sure kotlin-native within the cont...
# kotlin-native
k
Even though I’m sure kotlin-native within the context iOS development is mostly focused around the native side. Has there been any thoughts or considerations around leveraging kotlin-js & kotlin-native together? There’s a compelling reason to use js for the runtime like react-native to ease the deployment for bugfixes, etc. ala CodePush / over-the-air updates. That said, a seamless interop exchange between the native layer and the JS layer would be very interesting. Is this already possible with multi-platform projects? Is this crazy?
l
r
Multiplatform doesn't give you anything new for communication between platforms. It's just for compile-time code-sharing.
k
@louiscad I agree, it’s in the same spirit of those thoughts. It feels like Kotlin is extremely well positioned to do something very interesting (more so than already).
@russhwolf It could though in theory. If a js dependency could be fulfilled via a kotlin-native library for example. So using an example. The core app targeting both iOS and Android could “expect” to call an api to return the step count for the device. On Android the “actual” implementation would be a JVM implementation and return to the JS layer in the same way it does today with react-native sans “native modules” setup. On iOS the “actual” implementation would be the iOS SDK’s also avoiding the native interop concerns, or at least hides it away. I realize I’m probably naive in some of my thoughts, but it doesn’t seem a far stretch.
r
You can't plug-and-play between different platforms the way you're describing. There's no way to "fulfill a js dependency with a kotlin-native library" because they're different platforms that compile to different formats. And when you want your JVM layer to "return to the JS layer in the same way it does today with react-native", now you're losing your seamless interop because you've added a JS bridging layer. That said, there's still a lot of potential around code-sharing. You just shouldn't assume it gives you any ability to move between platforms at runtime other than what already exists.
u
You could teach the compiler to generate a js/ios bridge layer