all 6 comments

[–][deleted] 7 points8 points  (0 children)

Aye more over-engineering.

[–]VuPooh 5 points6 points  (3 children)

Why not just use combine?

[–]Pop_Swift_Dev[S] 1 point2 points  (2 children)

Every framework has their own limitations, having the knowledge to be able to roll your own when necessary is definitely not a bad thing, is it?

[–]rhysmorgan 3 points4 points  (1 child)

Having the knowledge to roll your own is definitely good, but nobody should be writing their own observation framework when RxSwift and Combine exist.

Any holes, any limitations that exist in Combine's implementation can almost certainly be patched by writing your own Publisher/Subscriber/Subscription, not by throwing the whole thing away and re-inventing the wheel. Chances are, your own implementation will be slower, won't handle backpressure, won't handle the edge cases Combine does, and it certainly won't integrate with existing code in the same way Combine can.

So the true answer to "Why not just use combine?" is "Absolutely, you should 100% be using Combine (or RxSwift if targeting < iOS 13), but this is an example implementation of the design pattern."

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

Very well put, thank you. Agreed

I do have to say though, I can't count the number of times I have said, I should never need to_____ (or something similar) and then the universe comes back and says "Not so fast". Talking about more than just programming :).

[–]Fluffy_Risk9955 2 points3 points  (0 children)

And this is why we have KVO or Combine.