I recently started using swift's Combine (I've used ReactiveCocoa before), I'm wondering if there is a concept of cold and hot signals also in Combine? Dose Publisher
is equal to cold signals(SignalProducers), and No hot signal in Combine? Thanks~
Asked
Active
Viewed 780 times
1

ImWH
- 820
- 1
- 7
- 20
-
1"Dose Publisher is equal to cold signals(SignalProducers), and No hot signal in Combine" No. In fact, most publishers in Combine are hot. Messages from a notification center, a Published property, etc. can arrive at any time. Good discussion at https://www.cocoawithlove.com/blog/twenty-two-short-tests-of-combine-part-2.html Keep in mind that Combine uses _backpressure_ which rather changes the equation. – matt Dec 13 '21 at 13:59
-
@matt thanks for comment! For a Publisher, depends on how it was created, It could be a hot signal or cold signal, For example when using Subject or NotificationCenter's Publisher, it would be a hot signal, when using Future or Just, It would be a cold signal, Is this correct? – ImWH Dec 13 '21 at 15:07
-
That's probably right, although I prefer to think of these as simply persistent publishers vs. "one-shot" publishers. :) – matt Dec 13 '21 at 15:12
1 Answers
1
A Publisher could be either cold or hot depending on what is backing it. By default though, publishers are cold with specific operators designed to heat them up.
Unlike in ReactiveCocoa, in Combine both hot and cold publishers use the same type.

Daniel T.
- 32,821
- 6
- 50
- 72