Not as easy as I would've liked but I have a working setup where Rust crate builds into static library into manually written Swift adapter package into Mac/iOS app. Resulting Mac app binary (x86_64 + aarm64) is only 2.3 MB.

This should enable having a shared Rust core of data structures and business logic that can be bridged into basically any platform, and a native UI can be derived from library calls that are exposed to it. This covers Mac and iOS, Rust itself can be used to build Linux apps, so next would be writing adapters for Kotlin/Java on Android and … whatever you use to build Windows apps these days.

Follow

Me: Ok I, a complete Rust newbie, have a working Rust bridge to C/Swift, so let me try to get it to do some async multi-threaded stuff in Rust with a callback to Swift.

Rust and the Send trait:

· · Web · 1 · 0 · 2

@stevestreza the swift-bridge crate I think has bridging of async/await calling if that’s helpful, though have yet to try that out myself. We only just started to use a little async/await in rust and it’s isolated currently.

Sign in to participate in the conversation
Mastodon

The original server operated by the Mastodon gGmbH non-profit