Asynchronous sequences are a core feature of Swift concurrency. They allow you to process asynchronous events easily using simple for
loops.
However, conforming to the AsyncSequence
protocol to create an asynchronous sequence is not straightforward.
That’s where AsyncStream
comes to the rescue, allowing you to easily create asynchronous sequences and quickly adapt old APIs to Swift concurrency.