In case anyone is interested, I built a Kotlin Com...
# kotlin-native
n
In case anyone is interested, I built a Kotlin Compiler plugin called
Knee
that binds Kotlin/Native to Kotlin/JVM, allowing them to interact transparently (uses JNI under the hood). It supports a wide array of features - classes/interfaces, lambdas, suspend functions with two-way cancellation, no-copy buffers. You can even import external types, e.g. create a
StateFlow
on K/N and collect it on the JVM. As of now it's androidNative only, but adding new targets is very easy. I just haven't found the right way of importing jni.h for cross-compiled targets in a way that would work for everyone. Happy to discuss! Link: https://github.com/deepmedia/Knee
🚀 10
🤯 4
❤️ 1
l
I'm impressed. I hope @eenriquelopez adds it to the next Kotlin Weekly !
e
Noted! Thanks for the ping, @louiscad. I didn’t have time to check it yet, but I will do it over the weekend 🙂
n
That'd be great, thank you guys! 🙏 I may also write a few blog posts about it in the future, there were many interesting challenges along the way.
👀 1
l
I'd love such a blog series!
It just struck me… This could be used to mix the JVM based Compose Desktop with AppKit on macOS, right?
plus1 1
n
I don't know much about macOS/AppKit. You can use Knee to make types and non-composable functions available to the JVM, then I guess AppKit views would need some kind of native window to draw into, you have to figure out this rendering part. And before that we must add the macOS target 😄 I have a plan but not sure if it's sound https://github.com/deepmedia/Knee/issues/7