https://kotlinlang.org logo
Title
g

Glen

11/20/2020, 9:01 AM
I was just thinking: Since Skia is a C/C++ library, is it possible to use Kotlin/Native to create Kotlin bindings for it and use it as a multiplatform library for iOS?
f

Foso

11/20/2020, 9:19 AM
I guess that should be possible. But you can't use Compose with Kotlin Native (for now)
g

Glen

11/20/2020, 9:25 AM
Yeah...
t

Tijl

11/20/2020, 9:30 AM
Skia does have an experimental C api, but I’m not sure how feature complete it is. AFAIK JVM based binding that use JNI (Skija/Skiko) bind the C++ API.
g

Glen

11/20/2020, 9:30 AM
I see...
t

Tijl

11/20/2020, 10:43 AM
since you ask this in the compose channel, I assume the goal would be to get it in Skiko to run Compose. Since Skija (afaik the Skiko API is imported from there) does a (their words) hand-crafted binding, if you’d craft the same binding for the C API, it’s not an impossible goal.
l

louiscad

11/20/2020, 10:55 AM
That's what Flutter has been doing for a while actually: using skia on iOS and Android.
t

Tijl

11/20/2020, 10:55 AM
both Android and iOS support C++ (edit to clarify: in their native toolchains)
cinterop does not. of course you can link a C++ generated binary, but you need C style headers for it to do cinterop
java <-> C++ interop through JNI is very clumsy, but it does work
g

Glen

11/21/2020, 3:18 PM
Yeah, cinterop does not play well with C++ for the moment. I hope it will come one day 🙂
Yeah, @louiscad. If That is what is making me hope that Kotlin might do the same. And Flutter uses the Dart engine/runtime...