geph-official / geph5

162 stars 30 forks source link

Rust -> Swift interop #18

Open lucasmerlin opened 4 months ago

lucasmerlin commented 4 months ago

Because I was curious myself what the best way to call swift would be I've implemented three different methods:

use @_cdecl to export swift functions and call them from rust via extern "C"

Pros:

Cons:

via objc using objc2 crate

We can declare a objc "class" in some objc glue code and use the objc2::extern_class macro to declare it in rust. Then we can call the swift code from our objective c code.

Pros:

Cons:

via swift-rs

We can create a swift package containing our ios swift code and link it to our rust code via swift-rs

Pros:

Cons: