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.

Follow

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.

· · Web · 3 · 0 · 1

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:

@stevestreza you might be able to do pure rust for windows fwiw. I know it’s at least on the horizon for us possibly moving to that.

@stevestreza At my former employer we had a shared library of Rust that worked on our backend service as well as our iOS App.

It’s such a great language and I love what you’re doing Steve.

@fahrni It took a long time to get comfortable with Rust but I'm glad it is working out in so many ways 😄 The goal was to find a 10+ year language with a wide array of uses and I'm hoping Rust is it.

@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