AsyncPublisher and Sendable

As far as I can tell AsyncPublisher and AsyncThrowingPublisher are not Sendable. I'm trying to address the Sendable warnings in our code when compiling with strict-concurrency.

The aforementioned types do not seem to be Sendable, but it seems to me they will be often used in context's that require them to be Sendable.

For example, I'm capturing a reference to an AsyncPublisher in a Task closure, and that closure requires the captures to be Sendable.

What are my options in this case?

1 Like

Hey @tourultimate , did you find the workaround for this? I'm currently doing what you're doing now and wondering how did you approach this.

IIRC, I don't think we were able to fix that warning. The region based isolation might eventually help.

1 Like

I got the same issue here. Passing an AsyncPublisher, which is commonly produced by .values of @Published array, into a function that iterates the values within a task triggers the warning of non-sendable type.

I don't know if there is an elegant solution to this common situation.