uniffi-rs
uniffi-rs copied to clipboard
Require Sendable for generated Swift protocols
In the documentation about callback interfaces, it says that uniffi enables that the rust traits used for callback interfaces can require Send and Sync but that this cannot be enforced on the foreign language side.
Swift has the Sendable protocol since a while now and it would be possible to require Sendable for all Swift protocols that are generated from callback interfaces. This would achieve a somewhat stronger guarantee that the callback interfaces are actually Send.
E.g. the following udl declaration:
callback interface Foo {
i32 bar();
};
could generate this Swift code:
public protocol Foo: AnyObject, Sendable {
func bar() -> Int32
}