There is a property on a UIViewController
subclass that changes when a view becomes visible. (A set stops being empty.) I've implemented KVC/KVO as follows:
- (void)viewWillAppear:(BOOL)animated {
[self willChangeValueForKey:@"anticipatedIndexPaths" withSetMutation:NSKeyValueSetSetMutation usingObjects:_anticipatedIndexPaths];
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
assert([_anticipatedIndexPaths count]);
[self didChangeValueForKey:@"anticipatedIndexPaths" withSetMutation:NSKeyValueSetSetMutation usingObjects:_anticipatedIndexPaths];
}
A subclass of that class is observing itself for @"anticipatedIndexPaths"
, but the value of NSKeyValueChangeNewKey
when observing NSKeyValueChangeReplacement
is always an empty set. What gives?