ReactiveCocoa/ReactiveCocoa — pull request #1034 by jspahrsummers (2013-12-27 21:12:33+00:00)
Title: BREAKING: Stop tying KVO observation lifetime to self

**:warning: NOT READY TO MERGE :warning:**

_Depends on #1026._

`RACObserve` and friends implicitly reference `self`, which can [cause retain cycles](https://github.com/ReactiveCocoa/ReactiveCocoa/issues/472) in blocks. I don't think the convenience of having KVO end when `self` deallocates is worth the bugs, so this PR removes that coupling.

The original intention was to help with code like this:

```
// In a view or view controller:
[RACObserve(viewModel, text) subscribeNext:^(NSString *text) {
// Do something with the text.
}];
```

… the problem being that `viewModel` could deallocate much later than `self`—or possibly never—causing the subscription to live much longer than one might expect.

However, I'd argue that code like this is far more common:

```objc
RAC(self.textField, text) = [RACObserve(viewModel, text) map:^(NSString *text) {
return text ?: @"";
}];

// Or similarly, using a lift:
[self.textField rac_liftSelector:@selector(setText:) withSignals:RACObserve(viewModel, text), nil];
```

… in which case, the observation automatically ceases when `self.textField` deallocates anyways. Or if you want finer grained control, you can use `rac_willDeallocSignal`.

Meanwhile, if `RACObserve` references `self`, observations within blocks are quite dangerous:

```objc
RAC(self, text) = [[viewModels
map:^(ViewModel *viewModel) {
// Whoops, retain cycle! `self` will never deallocate.
return RACObserve(viewModel, text);
}]
switchToLatest];
```

I find that _much_ more surprising than a subscription living longer than intended, and it's probably a more common source of memory management bugs.

@ReactiveCocoa/reactivecocoa

**To do:**

- [ ] Restore `observer` methods as deprecated APIs
- [ ] CHANGELOG