Looks like there’s a compilation issue with Swift when defining more than one async_trait. To help track it down, a small commit was made to reproduce the problem here. You can see it in action by running cargo test -p uniffi-fixture-multiple-definitions.
It turns out that defining this code only once seems to fix things:
// Protocol for tasks that handle foreign futures.
//
// Defining a protocol allows all tasks to be stored in the same handle map,
// which isn’t doable with the task object itself because of its generic parameters.
protocol UniffiForeignFutureTask {
func cancel()
}
extension Task: UniffiForeignFutureTask {}
👋 Hey there!
Looks like there’s a compilation issue with Swift when defining more than one async_trait. To help track it down, a small commit was made to reproduce the problem here. You can see it in action by running cargo test -p uniffi-fixture-multiple-definitions.
It turns out that defining this code only once seems to fix things: