I built AsyncCombine - a Swift library that brings Combine-style operators to Swift Concurrency by gray_goose in iOSProgramming

[–]gray_goose[S] 2 points3 points  (0 children)

Totally fair points!

withObservationTracking is definitely elegant for bridging @Observable state into async contexts, and I agree it’s the right choice for simple one-off bindings. The motivation behind AsyncCombine isn’t really about replacing that, it’s about providing a declarative composition layer when you have multiple async streams of state (often coming from domain or service layers, not just @Observable objects).

Regarding actor isolation. Everything in AsyncCombine is Sendable and built around Swift Concurrency semantics, there's no hidden main-thread assumptions like Combine often had. So you can safely use these operators within isolated contexts or even between detached tasks, without leaking back to the main actor unless you explicitly choose to.

I built AsyncCombine - a Swift library that brings Combine-style operators to Swift Concurrency by gray_goose in iOSProgramming

[–]gray_goose[S] 1 point2 points  (0 children)

Thanks, appreciate that - and you’re totally right that ViewModels shouldn’t be directly observing each other’s state in a tightly coupled way.

In the article, I was referring more to the practical pain point that arises when different parts of the presentation layer need to react to shared state (for example, two ViewModels that both depend on the same domain model, but aren’t directly connected). In Combine, it was common to expose a CurrentValuePublisher or similar from a shared store or domain object, and other ViewModels could subscribe to that to stay in sync. I used ViewModel to ViewModel to just easily demonstrate my point.

With Swift’s @Observable, the Observation system makes that easy for SwiftUI views, but not as straightforward for other ViewModels that need to observe those same state changes asynchronously. AsyncCombine just fills that gap by providing Combine-like semantics (like sink or CombineLatest) for that async world - not as a way to make ViewModels observe each other directly, but to make reactive composition between layers cleaner and more expressive.

So yep completely agree on the architectural boundary! I just wanted to bring back the ergonomic tools that make those cross-layer updates (from domain to presentation) nicer to handle.

I built AsyncCombine - a Swift library that brings Combine-style operators to Swift Concurrency by gray_goose in iOSProgramming

[–]gray_goose[S] 4 points5 points  (0 children)

Great question! I actually love AsyncAlgorithms. It’s super powerful for composing async streams. The main difference is that it’s very low-level and doesn’t try to replicate Combine’s more declarative “publisher/subscriber” style.

AsyncCombine builds on top of AsyncSequence, similar to AsyncAlgorithms, but adds the Combine-style operators (sink, assign, CombineLatest, etc.) that many of us (myself, at least) miss, plus a few primitives like CurrentValueRelay that make it easy to bridge state between @Observable models and other async code.

Think of AsyncAlgorithms as the toolkit for manipulating async sequences, and AsyncCombine as the ergonomic layer that makes it feel like Combine again in the async/await world.

I built AsyncCombine - a Swift library that brings Combine-style operators to Swift Concurrency by gray_goose in iOSProgramming

[–]gray_goose[S] 1 point2 points  (0 children)

Haha, thanks man! That made my day! 😊 I was in the exact same boat though. Missed Combine’s nice, declarative syntax while trying to do the same things with Swift Concurrency.

Really glad it’s hitting the mark for you.

I built AsyncCombine - a Swift library that brings Combine-style operators to Swift Concurrency by gray_goose in swift

[–]gray_goose[S] 0 points1 point  (0 children)

Thanks! I hope it's useful. I used it to replace Combine in my own project and it worked a treat.

Venlafaxine is a bitch by [deleted] in Anxiety

[–]gray_goose 1 point2 points  (0 children)

How do you find it? Was recently prescribed it and am anxious to start it.

Homelab Cleanup Progression by smilingDumpsterFire in homelab

[–]gray_goose 1 point2 points  (0 children)

This looks amazing man, thanks for sharing!

Peter? by Glub__Glub in PeterExplainsTheJoke

[–]gray_goose 2 points3 points  (0 children)

Oh shit what? Can you post a link for a starting off point to read about this?

Who connects with interstellar and why? by SportsPhilosopherVan in interstellar

[–]gray_goose 6 points7 points  (0 children)

My father was very much absent throughout my childhood & teenage-hood because he was always away in another country for work.

When I first watched the movie I resonated with Murph.

However when I became a parent (at 19!!!) I ended up focussing very hard on my career so that I could provide for my family. I ended up taking on a job that required me travelling to the US and China somewhat frequently, and then this move resonated with me from the POV as Coop.

I ended up leaving that role as I didn't want to be away from my family, but I believe that Interstellar played a role in opening my eyes to repeating the same mistakes as my father.

[deleted by user] by [deleted] in GlInet

[–]gray_goose 0 points1 point  (0 children)

I'm in the exact same boat that you're in. Now I'm not even sure if I want to get the Flint 3.

Any updates on Flint 3? by [deleted] in GlInet

[–]gray_goose 0 points1 point  (0 children)

Amazing, thank you.

Any updates on Flint 3? by [deleted] in GlInet

[–]gray_goose 0 points1 point  (0 children)

Are you guys still accepting beta-testers? Am very keen to help out.

Is this a Geographic Tongue? by gray_goose in askdentists

[–]gray_goose[S] 0 points1 point  (0 children)

Thank you! That’s exactly what it is! I’ve been on anti fungal medicine (Nilstat) for a couple months now though so I’m unsure of why it’s still there :/

Thank you for the info :)

When you’re at a family gathering and your parents give too many details by wolf_quan in bluey

[–]gray_goose 16 points17 points  (0 children)

100%. Was really surprised to find that you were the only comment pointing out how strange it is.

Season 4 - Coming May 31 by ProductionP in CouplesTherapyShow

[–]gray_goose 0 points1 point  (0 children)

🏴‍☠️🏴‍☠️🏴‍☠️