matrix-org / matrix-rust-components-swift

Swift package providing components from the matrix-rust-sdk
Apache License 2.0
26 stars 6 forks source link

Consider swift-bridge #2

Closed ShadowJonathan closed 2 years ago

ShadowJonathan commented 2 years ago

I'm recommending to look into swift-bridge, which recently has gotten async function support (though with a few caveats)

Considering uniffi is generic over many different calling conventions and libraries, it may take longer for them to add support for async, while swift-bridge can serve this library's usage more directly (and immidiately)

(I'm just leaving this issue here so it can be weighted against uniffi experiments, as a mention of an alternative)

ShadowJonathan commented 2 years ago

(Another advantage of swift-bridge might be its ergonomic use, with bidirectional bridging fairly easily achievable and abstracted away;) image

jplatte commented 2 years ago

I don't think this is realistic because swift-bridge seems to be less mature than uniffi overall, and it also looks to have a bus factor of 1.

Additionally, we're looking to bridge the Rust SDK to Kotlin in addition to Swift, where there doesn't seem to be a similar high-level alternative.

Finally, I want to respond to this:

Considering uniffi is generic over many different calling conventions and libraries, it may take longer for them to add support for async

A bunch of features in uniffi are already only supported for a subset of the languages it supports, so this shouldn't be a major concern.

jplatte commented 2 years ago

By the way, UniFFI is also considering more ergonomic ways of declaring the API: https://github.com/mozilla/uniffi-rs/issues/385