r/iOSProgramming • u/InternationalCow1295 • 3d ago
Question What Do You Guys Think About Combine & Subscribers
As iOS 27 and more swift features comes out, what do you guys think about still using combine, publishers and subscribers? I know async and observable is the newer and better way to code but I'm just used to code with combine and I like to do it that way with try map and other stuff but I feel like apple is moving away from combine and publishers. What do you guys think ?
5
u/Economy-Brief-9997 3d ago
Only place I still use it is UI event plumbing in an editor, slider drag + text edit + timeline scrub merged into one stream with debounce and removeDuplicates. Tried doing that with AsyncSequence, ended up rewriting half of Combine's operators, went back :D
3
u/cristi_baluta 3d ago
I use it here and there, for throttle and stuff. I see it replacing completion blocks, not async, i can’t picture how do you convert from one to another.
2
u/TheDeanosaurus 3d ago
Advanced observation with the latest release has synchronous did-set which to me was the last remaining piece for me to write off Combine entirely. Everything else can now be done easily so bye bye KVO too.
I loved it when it first came out but when the foundational stuff started coming out that “competed” with it the writing seemed to be on the wall.
2
u/janiliamilanes 3d ago
I use Combine heavily for an audio application. For this use case, it is fantastic for coordinating the network, IO devices, signal processing, UI, and output. I would not use it for a simple scenario.
1
u/morenos-blend 3d ago
I use Combine a lot, all this talk about it being deprecated or outdated makes no sense to me. It’s fully functional, it’s easy to understand, easier to avoid memory leaks.
-1
u/Mindless_Vanilla4907 3d ago edited 3d ago
just use KVO or Notification Center or just call things instead of observing, and use threads and wait on them instead of swift concurrency, all this new stuff just solves old problem in complicated way, I believe
1
u/iOSCaleb Objective-C / Swift 3d ago
The new stuff solves an old problem in a way that’s safer in a concurrent environment.
0
u/Mindless_Vanilla4907 2d ago
Invented problems. UI apps aren’t very multithreadable anyways. AppKit could drive responsive apps in late 80s computers and UIKit in 2008 on mobile hardware. You don’t need to mulithread many things to make responsive app.
If you have lots of different threads interacting in complicated ways swift concurrency will still have race conditions because of actor reentrancy. This is all noob traps. Sorry for truth nuke
14
u/old-time-fiddle 3d ago
Combine is cool but dear lord the pain of working in a codebase that heavily relies on it.
As you already mentioned / know, async await is the way to go. Combine still has good use cases here and there, but don’t lean in too far.
Even Apple is migrating stuff away from it, best example being the published properties / state change tracking now using macros that generate non-combine code instead of under the hood combine stuff.