You don’t need to retain signals in order to process them.
Subscribers
Any objects referenced from those blocks will therefore be retained as part of the subscription.
Finite or Short-Lived Signals
Subscription is automatically terminated upon completion or error, and the subscriber removed.
The RACSignal -> RACSubscriber relationship is torn down as soon as signal finishes, breaking the retain cycle.
Infinite Signals
Disposing of a subscription will remove the associated subscriber, and just generally clean up any resources associated with that subscription.
Signals Derived from self
Any time a signal’s lifetime is tied to the calling scope, you’ll have a much harder cycle to break.
This commonly occurs when using RACObserve() on a key path that’s relative to self, and then applying a block that needs to capture self.
1 2 3 4 5 |
|
1 2 3 4 5 |
|
1 2 3 4 |
|