OK so it looks like I wanted to be using the RACSubject
subclass RACReplaySubject
instead. Not sure how I missed that one!
ReactiveCocoa: Immediately send the latest value when there's a new subscription
-
14-10-2022 - |
Question
I have a bunch of manual RACSubject
properties in a particular view model; I am calling sendNext
at certain points in the code, and I want new subscribers to these signals to immediately have their subscribeNext
block be called with the latest value in that signal. Is this possible?
As an example, if I am sending the values 1 -> 12 -> 42
and then down the line there's a new subscriber, I want that subscriber to get 42
straight off (and then obviously listen for more pushes when they come about).
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow