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?

1 Like

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 GitHub - sindresorhus/Gifski: 🌈 Convert videos to high-quality GIFs on your Mac does it.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.