# \#asyncsequence

**URL:** https://forums.swift.org/tag/asyncsequence/712.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [AsyncSequence cancellation behaviour](https://forums.swift.org/t/asyncsequence-cancellation-behaviour/88944)

<div class="topic-metadata">

**Author:** [@BitByAVampire](https://forums.swift.org/u/BitByAVampire)\
**Replies:** 7\
**Last updated:** [August 13, 2026, 4:41pm UTC](https://forums.swift.org/t/asyncsequence-cancellation-behaviour/88944 "2026-08-13T16:41:33Z")

</div>

AsyncSequence | Apple Developer Documentation in The docs it does not say what the user's responsibility is for cancellation of the task. From reading other posts it seems like AsyncSequences are supposed to terminate th…

---

## [\[AsyncAlgorithms\] FlatMapLatest algorithm](https://forums.swift.org/t/asyncalgorithms-flatmaplatest-algorithm/84404)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 10\
**Last updated:** [March 8, 2026, 12:48am UTC](https://forums.swift.org/t/asyncalgorithms-flatmaplatest-algorithm/84404 "2026-03-08T00:48:36Z")

</div>

The flatMapLatest (also known as switchToLatest) are commonly requested algorithms for AsyncSequence; this proposal adds that functionality. Previously it was discussed in the pre-pitch here: PrePitch: Introduce \`(flat)…

---

## [Swift Async Algorithms Proposal: mapError](https://forums.swift.org/t/swift-async-algorithms-proposal-maperror/82104)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 9\
**Last updated:** [January 12, 2026, 6:00pm UTC](https://forums.swift.org/t/swift-async-algorithms-proposal-maperror/82104 "2026-01-12T18:00:03Z")

</div>

Map Error Proposal: SAA-NNNN Authors: Clive Liu Philippe Hausler Review Manager: TBD Status: Awaiting review Introduction Asynchronous sequences often particpate in carefully crafted systems of algorithms spliced toget…

---

## [AsyncSequence from URLSessionWebSocketTask?](https://forums.swift.org/t/asyncsequence-from-urlsessionwebsockettask/82858)

<div class="topic-metadata">

**Author:** [@CodebyCR](https://forums.swift.org/u/CodebyCR)\
**Replies:** 10\
**Last updated:** [November 3, 2025, 9:23am UTC](https://forums.swift.org/t/asyncsequence-from-urlsessionwebsockettask/82858 "2025-11-03T09:23:49Z")

</div>

Hey there, I’m currently planing with WebSockets and was a bit surprised that I don’t found any method to get an Async(Throwing)Sequence with the incoming Messges. Anyways I think that is a common expectation, so are t…

---

## [AsyncSequence version of notifications is causing memory leaks](https://forums.swift.org/t/asyncsequence-version-of-notifications-is-causing-memory-leaks/77257)

<div class="topic-metadata">

**Author:** [@crontab](https://forums.swift.org/u/crontab)\
**Replies:** 21\
**Last updated:** [October 7, 2025, 6:29pm UTC](https://forums.swift.org/t/asyncsequence-version-of-notifications-is-causing-memory-leaks/77257 "2025-10-07T18:29:39Z")

</div>

Possibly a stupid question, but I'm new to AsyncSequence and friends, and I don't understand how to terminate the following loop. The function is taken from Apple's AVCam demo app: actor CaptureService { // ... …

---

## [NotificationCenter.default.messages() & AsyncAlgorithms collide](https://forums.swift.org/t/notificationcenter-default-messages-asyncalgorithms-collide/81674)

<div class="topic-metadata">

**Author:** [@Fritzt](https://forums.swift.org/u/Fritzt)\
**Replies:** 4\
**Last updated:** [September 10, 2025, 5:48pm UTC](https://forums.swift.org/t/notificationcenter-default-messages-asyncalgorithms-collide/81674 "2025-09-10T17:48:27Z")

</div>

I'm trying to compose AsyncSequence of AsyncMessage using functionality from the AsyncAlgorithms package. However, this seems not supported because most of the algorithms in AsyncAlgorithms require input sequences to be S…

---

## [\`Streaming\`, looking for feedback](https://forums.swift.org/t/streaming-looking-for-feedback/81648)

<div class="topic-metadata">

**Author:** [@nikolai.ruhe](https://forums.swift.org/u/nikolai.ruhe)\
**Replies:** 5\
**Last updated:** [August 16, 2025, 2:26am UTC](https://forums.swift.org/t/streaming-looking-for-feedback/81648 "2025-08-16T02:26:02Z")

</div>

I made this property wrapper that turns a stored property into an async sequence. Its semantics are similar to Combine’s CurrentValueSubject. Multiple clients are allowed. By default, buffering is disabled. What do you…

---

## [\[Pitch\] Limited Parallelism TaskGroup](https://forums.swift.org/t/pitch-limited-parallelism-taskgroup/80404)

<div class="topic-metadata">

**Author:** [@techinessoverloaded](https://forums.swift.org/u/techinessoverloaded)\
**Replies:** 38\
**Last updated:** [July 29, 2025, 3:01pm UTC](https://forums.swift.org/t/pitch-limited-parallelism-taskgroup/80404 "2025-07-29T15:01:51Z")

</div>

We know that OperationQueue is still commonly used in codebases to achieve parallel decomposition of work. Its counterpart in Structured Concurrency is TaskGroup. However, OperationQueue provides a convenient way to limi…

---

## [Wrapping a non-throwing AsyncIterator](https://forums.swift.org/t/wrapping-a-non-throwing-asynciterator/80493)

<div class="topic-metadata">

**Author:** [@CrownedPhoenix](https://forums.swift.org/u/CrownedPhoenix)\
**Replies:** 0\
**Last updated:** [June 16, 2025, 4:59pm UTC](https://forums.swift.org/t/wrapping-a-non-throwing-asynciterator/80493 "2025-06-16T16:59:26Z")

</div>

I'm trying to get code like this to compile: public struct AsyncIterator\<Iterator: AsyncIteratorProtocol\>: AsyncIteratorProtocol { private var iterator: Iterator init(wrapping iterator: Iterator) { self…

---

## [Correct primitive for awaiting one AsyncSequence, and sending to another?](https://forums.swift.org/t/correct-primitive-for-awaiting-one-asyncsequence-and-sending-to-another/79944)

<div class="topic-metadata">

**Author:** [@AlexanderM](https://forums.swift.org/u/AlexanderM)\
**Replies:** 9\
**Last updated:** [June 11, 2025, 2:26am UTC](https://forums.swift.org/t/correct-primitive-for-awaiting-one-asyncsequence-and-sending-to-another/79944 "2025-06-11T02:26:54Z")

</div>

I'm working through the Crafting Interpreters book, and for extra fun, I'm playing with using Async Swift to coordinate the various parts together. One example is the REPL. Fundamentally, it's just a function ot type (A…

---

## [Get warnings when infinite AsyncSequence causes code to never be reached](https://forums.swift.org/t/get-warnings-when-infinite-asyncsequence-causes-code-to-never-be-reached/80272)

<div class="topic-metadata">

**Author:** [@Lancelotbronner](https://forums.swift.org/u/Lancelotbronner)\
**Replies:** 5\
**Last updated:** [June 3, 2025, 8:22pm UTC](https://forums.swift.org/t/get-warnings-when-infinite-asyncsequence-causes-code-to-never-be-reached/80272 "2025-06-03T20:22:39Z")

</div>

I'd like to open the discussion on this footgun you've probably encountered or at least heard about: Task { for await result in myValues { // ... } // Will never run: 'myValues' is infinite. myImp…

---

## [\[Pitch\] Generalize \`AsyncSequence\` and \`AsyncIteratorProtocol\`](https://forums.swift.org/t/pitch-generalize-asyncsequence-and-asynciteratorprotocol/69283)

<div class="topic-metadata">

**Author:** [@hborla](https://forums.swift.org/u/hborla)\
**Replies:** 23\
**Last updated:** [May 28, 2025, 4:09pm UTC](https://forums.swift.org/t/pitch-generalize-asyncsequence-and-asynciteratorprotocol/69283 "2025-05-28T16:09:56Z")

</div>

Hello, Swift evolution! I wrote up a dedicated pitch detailing solutions to two fundamental issues with AsyncSequence and AsyncIteratorProtocol: the bespoke-and-limited @rethrows attribute, and issues with Sendable chec…

---

## [Issue: A Stream will continue to produce elements even when its continuation has been finished](https://forums.swift.org/t/issue-a-stream-will-continue-to-produce-elements-even-when-its-continuation-has-been-finished/79746)

<div class="topic-metadata">

**Author:** [@couchdeveloper](https://forums.swift.org/u/couchdeveloper)\
**Replies:** 4\
**Last updated:** [May 7, 2025, 1:52pm UTC](https://forums.swift.org/t/issue-a-stream-will-continue-to-produce-elements-even-when-its-continuation-has-been-finished/79746 "2025-05-07T13:52:17Z")

</div>

According the documentation for AsyncThrowingStream.Continuation/finish(throwing:) the associated stream would not produce any elements anymore after the continuation has been finished: "Resume the task awaiting the nex…

---

## [Are there continuations for synchronous code?](https://forums.swift.org/t/are-there-continuations-for-synchronous-code/79628)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 15\
**Last updated:** [May 4, 2025, 9:07am UTC](https://forums.swift.org/t/are-there-continuations-for-synchronous-code/79628 "2025-05-04T09:07:56Z")

</div>

Specifically, I want an iterator for a container that would be better using a yielding interface. I just discovered the AsyncStream generic type that lets sources yield their elements upstream. The problem is that AsyncS…

---

## [\[Pitch\] Transactional observation of values](https://forums.swift.org/t/pitch-transactional-observation-of-values/78315)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 96\
**Last updated:** [April 15, 2025, 6:46pm UTC](https://forums.swift.org/t/pitch-transactional-observation-of-values/78315 "2025-04-15T18:46:51Z")

</div>

After much anticipation and a lot of footwork, I am really excited to present something I have been working on for a bit now. A transactional observation mechanism to provide an AsyncSequence from approachable compositio…

---

## [\[Pitch\] New APIs for Async\[Throwing\]Stream with backpressure support](https://forums.swift.org/t/pitch-new-apis-for-async-throwing-stream-with-backpressure-support/65449)

<div class="topic-metadata">

**Author:** [@FranzBusch](https://forums.swift.org/u/FranzBusch)\
**Replies:** 27\
**Last updated:** [April 3, 2025, 10:08pm UTC](https://forums.swift.org/t/pitch-new-apis-for-async-throwing-stream-with-backpressure-support/65449 "2025-04-03T22:08:12Z")

</div>

Hi Swift Evolution, Here's a proposal for adding new APIs to Async\[Throwing\]Stream to add support for bridging backpressured systems. Proposal PR can be found here . Introduction SE-0314 introduced new Async\[Throwing\]S…

---

## [AsyncPublisher and Sendable](https://forums.swift.org/t/asyncpublisher-and-sendable/65466)

<div class="topic-metadata">

**Author:** [@tourultimate](https://forums.swift.org/u/tourultimate)\
**Replies:** 11\
**Last updated:** [April 2, 2025, 7:22pm UTC](https://forums.swift.org/t/asyncpublisher-and-sendable/65466 "2025-04-02T19:22:20Z")

</div>

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 b…

---

## [Writing testable UI related code with modern Swift](https://forums.swift.org/t/writing-testable-ui-related-code-with-modern-swift/77944)

<div class="topic-metadata">

**Author:** [@async\_confusion](https://forums.swift.org/u/async_confusion)\
**Replies:** 19\
**Last updated:** [February 21, 2025, 8:21pm UTC](https://forums.swift.org/t/writing-testable-ui-related-code-with-modern-swift/77944 "2025-02-21T20:21:39Z")

</div>

Hello, I am trying to understand how I can migrate some of my older Combine /ObservedObject/Quick/Nimble based code to modern async/Observable/Swift Testing code but am running into problems with even very simple situati…

---

## [AsyncSequence / Stream version of PassthroughSubject or CurrentValueSubject?](https://forums.swift.org/t/asyncsequence-stream-version-of-passthroughsubject-or-currentvaluesubject/60395)

<div class="topic-metadata">

**Author:** [@filiplazov](https://forums.swift.org/u/filiplazov)\
**Replies:** 20\
**Last updated:** [January 21, 2025, 1:26am UTC](https://forums.swift.org/t/asyncsequence-stream-version-of-passthroughsubject-or-currentvaluesubject/60395 "2025-01-21T01:26:13Z")

</div>

Hello everyone, I have searched for couple of hours on async sequence / stream (I am still new to the swift concurrency) and can not find anything that resembles a PassthroughSubject or CurrentValueSubject from Combine …

---

## [Unclear Actor Isolation in AsyncStream](https://forums.swift.org/t/unclear-actor-isolation-in-asyncstream/77098)

<div class="topic-metadata">

**Author:** [@sibutrip](https://forums.swift.org/u/sibutrip)\
**Replies:** 2\
**Last updated:** [January 9, 2025, 9:53pm UTC](https://forums.swift.org/t/unclear-actor-isolation-in-asyncstream/77098 "2025-01-09T21:53:43Z")

</div>

Hey folks, I'm looking to use AsyncStream, but I've run into some issues with two possible approaches. I'll paste the code snippet with relevant comments below. This problem resembles this outstanding issue (\`Task { \[w…

---

## [Possible to return an AsyncSequence\<T\> for iOS 17 when building against iOS 18?](https://forums.swift.org/t/possible-to-return-an-asyncsequence-t-for-ios-17-when-building-against-ios-18/76107)

<div class="topic-metadata">

**Author:** [@EthanLS](https://forums.swift.org/u/EthanLS)\
**Replies:** 8\
**Last updated:** [December 19, 2024, 8:21pm UTC](https://forums.swift.org/t/possible-to-return-an-asyncsequence-t-for-ios-17-when-building-against-ios-18/76107 "2024-12-19T20:21:15Z")

</div>

AsyncSequence got changed in iOS 18, and now I can't figure out how to use it as a return type in a way that works with both 17 and 18. Example: func subscribe() -\> any AsyncSequence\<String\> { ... } Gives Error: Prot…

---

## [Is \`sending\` allowed in AsyncSequences?](https://forums.swift.org/t/is-sending-allowed-in-asyncsequences/76498)

<div class="topic-metadata">

**Author:** [@dehesa](https://forums.swift.org/u/dehesa)\
**Replies:** 4\
**Last updated:** [December 10, 2024, 3:50pm UTC](https://forums.swift.org/t/is-sending-allowed-in-asyncsequences/76498 "2024-12-10T15:50:13Z")

</div>

Is it possible to use sending on the return type of an AsyncSequence's next(isolation:) function? I am trying to create an async sequence "forwarding" non-sendable values. These non-sendable values are created by the as…

---

## [In SE-0314, AsyncStream, why does the unfolding function present backpressure?](https://forums.swift.org/t/in-se-0314-asyncstream-why-does-the-unfolding-function-present-backpressure/76450)

<div class="topic-metadata">

**Author:** [@thai-d-v](https://forums.swift.org/u/thai-d-v)\
**Replies:** 0\
**Last updated:** [December 7, 2024, 3:48am UTC](https://forums.swift.org/t/in-se-0314-asyncstream-why-does-the-unfolding-function-present-backpressure/76450 "2024-12-07T03:48:55Z")

</div>

Can anybody here help me understand what it means by presenting backpressure here? Alternatively if a source is just an async function (one that represents a backpressure) an AsyncStream can be constructed by unfolding…

---

## [AsyncStream stops yielding values](https://forums.swift.org/t/asyncstream-stops-yielding-values/75514)

<div class="topic-metadata">

**Author:** [@Biclops](https://forums.swift.org/u/Biclops)\
**Replies:** 9\
**Last updated:** [October 25, 2024, 4:51am UTC](https://forums.swift.org/t/asyncstream-stops-yielding-values/75514 "2024-10-25T04:51:37Z")

</div>

Hello I'm a beginner to Swift Concurrency and have run into an issue with AsyncStream. I've run into a situation that causes an observing of a for loop to receiving a values from an AsyncStream. At the bottom is the co…

---

## [\[Pitch\] Observation (Revised)](https://forums.swift.org/t/pitch-observation-revised/63757)

<div class="topic-metadata">

**Author:** [@Philippe\_Hausler](https://forums.swift.org/u/Philippe_Hausler)\
**Replies:** 117\
**Last updated:** [October 10, 2024, 5:08pm UTC](https://forums.swift.org/t/pitch-observation-revised/63757 "2024-10-10T17:08:29Z")

</div>

Observation Proposal: SE-NNNN Authors: Philippe Hausler, Nate Cook Review Manager: TBD Status: Awaiting implementation Changes Pitch 1: Initial pitch Pitch 2: Previously Observation registered observers directly to Ob…

---

## [Availability of \`Failure\` type in \`AsyncSequence\`](https://forums.swift.org/t/availability-of-failure-type-in-asyncsequence/75019)

<div class="topic-metadata">

**Author:** [@aetherealtech](https://forums.swift.org/u/aetherealtech)\
**Replies:** 0\
**Last updated:** [September 29, 2024, 6:43pm UTC](https://forums.swift.org/t/availability-of-failure-type-in-asyncsequence/75019 "2024-09-29T18:43:10Z")

</div>

I've been playing around with AsyncSequence which has now been updated to have a Failure associatedtype, with availability restricted to the latest platform versions. But I encountered something curious. The flatMap op…

---

## [Filter out 9 of 10 elements in an async stream](https://forums.swift.org/t/filter-out-9-of-10-elements-in-an-async-stream/73511)

<div class="topic-metadata">

**Author:** [@mleo](https://forums.swift.org/u/mleo)\
**Replies:** 3\
**Last updated:** [July 28, 2024, 1:50am UTC](https://forums.swift.org/t/filter-out-9-of-10-elements-in-an-async-stream/73511 "2024-07-28T01:50:35Z")

</div>

I have an async data stream that sends more data than I want to process. Is there an efficient way to toss 9 of 10 elements?

---

## [AsyncStream Element delivery](https://forums.swift.org/t/asyncstream-element-delivery/73454)

<div class="topic-metadata">

**Author:** [@emefde](https://forums.swift.org/u/emefde)\
**Replies:** 6\
**Last updated:** [July 26, 2024, 9:32am UTC](https://forums.swift.org/t/asyncstream-element-delivery/73454 "2024-07-26T09:32:04Z")

</div>

Good morning! I've been going through my projects code base trying to adapt some of its callback/delegation-based API's to Swift Concurrency world using AsyncStreams. Looking at the documentation it seemed like the per…

---

## [Combine's PassthroughSubject inside an actor, is it safe?](https://forums.swift.org/t/combines-passthroughsubject-inside-an-actor-is-it-safe/73136)

<div class="topic-metadata">

**Author:** [@Mika5652](https://forums.swift.org/u/Mika5652)\
**Replies:** 5\
**Last updated:** [July 17, 2024, 3:51pm UTC](https://forums.swift.org/t/combines-passthroughsubject-inside-an-actor-is-it-safe/73136 "2024-07-17T15:51:27Z")

</div>

Hello, I tried to implement dependency for synchronizing some values in the dictionary and then send that data outside through the observed function. This observer is AsyncStream, but internally I am using PassthroughSub…

---

## [How to use Combine publisher with Swift concurrency? (Publisher.values could miss events)](https://forums.swift.org/t/how-to-use-combine-publisher-with-swift-concurrency-publisher-values-could-miss-events/67193)

<div class="topic-metadata">

**Author:** [@gbitaudeau](https://forums.swift.org/u/gbitaudeau)\
**Replies:** 8\
**Last updated:** [July 4, 2024, 4:07pm UTC](https://forums.swift.org/t/how-to-use-combine-publisher-with-swift-concurrency-publisher-values-could-miss-events/67193 "2024-07-04T16:07:09Z")

</div>

The Publisher documentation explain that : The property values exposes a publisher’s elements as an AsyncSequence , allowing you to iterate over them with for -await -in rather than attaching a Subscriber What I under…

[Next page](https://forums.swift.org/tag/asyncsequence/712.md?match_all_tags=true&page=1&tags%5B%5D=asyncsequence)
