Hacker News new | past | comments | ask | show | jobs | submit login

Does anyone here have experience on using Rust for shared business logic between Android and iOS? It's something I'm considering but it seems there isn't a lot of documentation around it.

For iOS, you create C FFI bindings for your lib. Then you conpile a universal binary with cargo-lipo and use it from Swift like a C library.

For Android you write JNI bindings with something like rust-jni.

So yes, you have to write bindings twice. For an example project check out https://github.com/dbrgn/candidateparser and https://www.reddit.com/r/rust/comments/7aam04/meetup_slides_...

Yes, we're sharing Rust code through Kotlin on Android and Swift on iOS. https://github.com/mozilla/application-services/tree/master/...

Currently you could use kotlin/native for such effort.

the game "A Snakes Tale" was released on IOS and Android simultaneously, 100% Rust. The author is on twitter might have useful info for you.

Rust aside, this is a well done little puzzle game and worth the few bucks. It's on Steam, also.

Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact