Using AsyncSequence in Swift
Published on
- This article is part of my Modern Concurrency in Swift Article Series.*
Table of Contents
- Modern Concurrency in Swift: Introduction
- Understanding async/await in Swift
- Converting closure-based code into async/await in Swift
- Structured Concurrency in Swift: Using async let
- Structured Concurrency With Group Tasks in Swift
- Introduction to Unstructured Concurrency in Swift
- Unstructured Concurrency With Detached Tasks in Swift
- Understanding Actors in the New Concurrency Model in Swift
- @MainActor and Global Actors in Swift
- Sharing Data Across Tasks with the @TaskLocal property wrapper in the new Swift Concurrency Model
- Using AsyncSequence in Swift
- Modern Swift Concurrency Summary, Cheatsheet, and Thanks
Along the new concurrency APIs introduced in Swift at WWDC2021, we have AsyncSequence. AsyncSequence
is a collection protocol that allow us to receive data in loops and even top higher order functions - such as filter
, map
and reduce
- asynchronously, being able to await
for new data as it becomes available.