Custom Combine Publishers/Subscribers

I have been using Combine in some of my newer projects and after a while I realized I wrote several custom publishers/operators/subscribers. I decided to gather them in a Github repo since when I was implemented them I struggled with working examples. Hopefully it is useful to someone!

The testing subscribers are specially useful ;)

6 Likes

A little update on this project: After working more thoroughly with Combine, the backpressure concept starts to gain importance and it is surprising how little the community seems to have delve on it (i.e. I haven't seen many articles on it).

It took me a while to understand it, but you can build some powerful tools with it. For example:

  • Custom subscribers for fixed, diminishing, or incremental demand requests.
  • Control maximum in-flight API calls or database accesses.

I have been using some of those in my projects and decided to update Conbini's Github repo with them in the hope it is helpful to someone. It is actually surprising how mechanical (and fast) is the creation of new publishers/subscribers once you have distilled its core competences (which I did with the Lock/State property wrapper.

Conbini has been a good source of inspiration for custom Combine usage, thanks!

1 Like