Hacker News new | ask | show | jobs
by jashephe 1129 days ago
A tangent: does anyone have recommendations for a library for easy Swift-Rust interop? This is a cool tool, but I’d much rather make a GUI natively with e.g. SwiftUI and then call out to Rust for business logic. The previous times I’ve looked into this, both languages had to communicate through a C intermediate, and handling more complex types became a chore…
3 comments

A bit late, but swift-bridge (https://github.com/chinedufn/swift-bridge) does this intelligently, and is probably what you're looking for.
Mozilla's uniffi-rs is really good. You write a common IDL and the bindings are generated automatically. It supports Swift, Kotlin, Python, Ruby and JavaScript (not in the official repo).

https://github.com/mozilla/uniffi-rs

There was a talk given on this subject at iOSoho if ya want to take a peek:

https://youtu.be/8ApcIOZe9qg?t=1921