top | item 37073422

(no title)

yvgny | 2 years ago

Yes, you can do that. UniFFI allows you to generate Kotlin and Swift wrappers, which you can wrap in a RN wrapper. We did this at work for a cross-platform mobile app, it's a bit of a headache to create because that are some subtleties with async or these kind of things, and they are handled differently in the UniFFI wrappers and RN wrapper, but for relatively simple libs I find it pretty convenient.

discuss

order

pzo|2 years ago

Wouldn't this negate the effort of having cross platform Rust Module that now you have to manually create RN wrapper to autogenerated Kotlin and Swift wrappers? Also I think all previous RN bindings from JS to Swift, Java are async in nature end comes with performance penalty (serialization back and forth and async queue)?

Would be great if React Native team extend TurboModules to support generating Rust interop instead of just C++ - there are many truely cross platform rust modules (including support for iOS/android) than c++ and cargo makes much better developer experience than cmake.

nicoburns|2 years ago

What would be really awesome would be a tool for generating JSI bindings to Rust code. Then you wouldn't need to go via Kotlin or Swift. I believe there are no technical barriers to such a tool. Someone just needs to implement it.

zengid|2 years ago

Most of the details for doing this are over my head but wow what a nerd-snipe!