Why does Subject in Combine not conform to Subscriber

A subject is able to receive and publish values.

So what is the reasoning behind requiring implementers of the Subject protocol to only conform to Publisher, not Subscriber as well?

Because Subject doesn't receive values in the same fashion that subscribers (operators or the end points) do - they're meant for integrating with imperative code, so to have them "receive" data, you need to explicitly call send() on them, rather than the ebb-and-flow dance that the rest use with (demand) -> (accepting values up to the demand) kind of thing.

2 Likes
Terms of Service

Privacy Policy

Cookie Policy