Swift interop from rust ios/osx code

So not entirely sure if this the right place; but is there any ongoing work in rust -> swift interop (specifically to be able to code iOS widgets, which use swift only apis? Or really any preliminary thoughts on how to solve this?

Unfortunately there is no direct interoperability with Swift, and there's no real work towards this.

Currently these two languages can only talk to each other via a C API. In Rust you export #[no_mangle] extern "C" functions, and in Swift you use ObjC bridging headers and unsafe unretained pointers to use Rust's functions and data.

You can see how https://github.com/sindresorhus/Gifski does it.

1 Like