Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift: invalid redeclaration of 'UniffiForeignFutureTask' #2310

Open
QuentinPerez opened this issue Nov 13, 2024 · 0 comments
Open

Swift: invalid redeclaration of 'UniffiForeignFutureTask' #2310

QuentinPerez opened this issue Nov 13, 2024 · 0 comments

Comments

@QuentinPerez
Copy link
Contributor

QuentinPerez commented Nov 13, 2024

👋 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:

// 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 {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant