WWDC 2021: AsyncSequence vs. Combine
AsyncSequence is a new protocol in Swift 5.5 that offers facilities for processing asynchronous data. But is it a Combine replacement…? Let’s find out! By Jessy Catterwaul.
Who is this for?
This is intended for iOS developers who have experience using Combine, an understanding of how Swift’s Sequence protocol works, and have at least experimented with async/await in Swift 5.5. If that doesn’t describe you quite yet, try following along anyway—the other courses on raywenderlich.com that can help you get up to speed will be called out.
Part 1: WWDC 2021: AsyncSequence vs. Combine
To understand AsyncSequence, it will help to start thinking about it as a simple wrapper around an AsyncIterator — an aynschronous answer to Swift’s Sequence.
Swift’s concurrency system doesn’t have a type that matches what Combine’s Subjects can do, but that’s okay! Combine and AsyncSequence play nicely together.