Post

Replies

Boosts

Views

Activity

Reply to Distributing Swift App that calls RUST binary to the App Store
I recently created a prototype of a macOS app that embeds a large Rust library (Apache Arrow & DataFusion). The Swift side of the library can be seen at https://github.com/parquette/Parquette/tree/main/SwiftArrow/ and the Rust side is at https://github.com/parquette/arcolyte/ . The fully notarized universal app can be downloaded and run from https://github.com/parquette/Parquette/releases/ . The process is that it builds the Rust library that exposes a primitive C FFI interface (via cbindgen). This is built as a static library (for both Intel & M1) and embedded in the Swift library, which enables it to be invoked directly via Swift's C language support (see the headers referenced by SwiftArrow.modulemap). These FFI bindings are tedious to write and maintain, since there are no Rust swift-bindgen tools (yet) to help you out. If you only need a coarse-grained interface to your Rust code like invoking the main() method and handing the return code, it shouldn't be too difficult to just call them directly from Swift. There's a lot of little tricky moving parts to getting everything working together, so you may just want to fork the project as a starting point to see if your library can be embedded in the same way.
Mar ’21