Open adriantofan opened 9 years ago
That sounds like a bug, if true. Could you please distill it down into a minimal test case? :pray:
Yes, Here is the code:
@interface ViewController:UIViewController
@property (nonatomic,strong,readwrite) RVMViewModel* viewModel;
@end
@implementation ViewController
-(void)viewDidLoad{
[super viewDidLoad];
self.viewModel = [[RVMViewModel alloc] init];
[[[[RACSignal
combineLatest:@[
/*A */ self.viewModel.didBecomeActiveSignal]]
/*B RACObserve(self.viewModel,active)]] */
deliverOnMainThread]
distinctUntilChanged]
subscribeNext:^(RACTuple* x) {
NSLog(@"...");
}];
self.viewModel.active = YES;
}
@end
I would be happy to investigate further if you can give me any pointer about what might be wrong.
Thank you, Adrian
@adriantofan Is that a RACObserve
inside another RACObserve
? That may be the source of the issue.
@ashfurrow no, that was a typo. Sorry about that
Ah, so, didBecomeActiveSignal
will send the view model whenever a change occurs. That won't automatically cause a cycle, but it could result in problems if you replay the signal (thus keeping the view model alive), or capture the sent value in a block or something.
Hello,
I have a retain cycle in my code caused by the following setup in
viewDidLoad
The option A is causing a retain cycle so the view model is never released. B works fine. Do you see something wrong with the code or it might be a bug ?
Thank you, Adrian