Quantcast
Channel: Combine: Asynchronous Programming with Swift - Kodeco Forums
Viewing all articles
Browse latest Browse all 26

Why do publishers subscribe instead of subscribers?

$
0
0

Hello,

Could someone please help me understand why linguistically a publisher connects to a subscriber instead of the other way around?

For example in Chapter 2: Custom Subscriber, we do:

let subscriber = IntSubscriber()
publisher.subscribe(subscriber)

Because, as in the Apple documentation:

Publisher>>subscribe(_:)
Attaches the specified subscriber to this publisher.

Can anyone explain that language to me? It would make more sense to me if a subscriber subscribed to a publisher…in other words, here I am, some publisher of values, waiting for someone to “subscribe” to me.

I would kind of understand it if it was:

Publisher>>subscriber(_:)

instead, where we would be saying, ok, publisher, here is another subscriber.

If anyone has a good way of thinking about this I would love to hear it because I can memorize it but it still trips me up!

Thank you!

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 26

Trending Articles