Legacy callback based api to AsyncSequence

Is there an obvious way to transform a legacy callback based API, that delivers multiple values over time by executing the callback multiple times, to a AsyncSequence?

I implemented a a solution using Combine, but since Combine is a higher level API than AsyncSequence there should be a better solution.

Since this is a common use case we should consider providing a convenient way to wrap these legacy APIs in an AsyncSequence.

3 Likes

It seems that @Tony_Parker ist already working on a solution:

4 Likes