Building an AsyncSequence with AsyncStream.makeStream

  Рет қаралды 632

donny wals

donny wals

Күн бұрын

Пікірлер: 7
@priceringo1756
@priceringo1756 8 ай бұрын
Thank for such great, simple but not trivial, examples!
@aleksandrzinovev429
@aleksandrzinovev429 Ай бұрын
You have a talent for explaining complex concepts clearly
@DonnyWalsdev
@DonnyWalsdev Ай бұрын
Thank you!
@indiekiduk
@indiekiduk 8 ай бұрын
I think makeStream is an anti-pattern because I ran into issues when using like cancellation not working. Once I redesigned my async code and made AsyncStream own the object that yields values all my problems were solved!
@DonnyWalsdev
@DonnyWalsdev 8 ай бұрын
Any chance you have a gist that would demonstrate the issues you've had? The tests I ran involved moving from the older AsyncStream init to makeStream and I didn't see these issues.
@indiekiduk
@indiekiduk 8 ай бұрын
@@DonnyWalsdev ok I'm trying to work on that. I noticed you had onTermination = { [weak self] that must have been to work around the retain cycle issue.
@indiekiduk
@indiekiduk 8 ай бұрын
I've been investigating this all day and I think makeStream is fine. By using a weak var in the parent object and using onTerminate to capture a strong reference to the stream's object I can make cancellation deinit the stream's object properly. My test harness has a task group with 2 tasks that call the same stream property on its containing object (to make sure the first stream is cancelled). I can only have one stream working at a time despite the object's stream property being a computed var that returns a new stream, so I wanted it to also cancel a previous stream.
Reconsidering @Published - Combine to Async Part 1
8:37
Daniel Steinberg
Рет қаралды 1,9 М.
That's NOT How Async And Await Works in .NET!
12:25
Codewrinkles
Рет қаралды 26 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 42 МЛН
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 116 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 139 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 36 МЛН
Using Closures as Dependencies
15:18
donny wals
Рет қаралды 1,3 М.
The Only Database Abstraction You Need | Prime Reacts
21:42
ThePrimeTime
Рет қаралды 224 М.
Actor Reentrancy in Swift explained
20:18
donny wals
Рет қаралды 3 М.
AsyncStream, SwiftUI Charts and Insertion sort
7:29
Exploring Swift
Рет қаралды 133
Master The Svelte Context API
18:07
Joy of Code
Рет қаралды 7 М.
Concurrency vs. Parallelism
7:03
Dave Xiang
Рет қаралды 36 М.
Learn Python's AsyncIO in 15 minutes
14:02
Indently
Рет қаралды 53 М.
3 MISTAKES to avoid when using Async / Await in Swift 😌
4:41
Vincent Pradeilles
Рет қаралды 12 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 42 МЛН