Skip to content

Instantly share code, notes, and snippets.

@atsusy
Last active August 29, 2015 14:04
Show Gist options
  • Save atsusy/c724dffec96b95324c2f to your computer and use it in GitHub Desktop.
Save atsusy/c724dffec96b95324c2f to your computer and use it in GitHub Desktop.
Array insertion/deletion signal
RACSignal *s = [self rac_valuesAndChangesForKeyPath:@keypath(self, mutableArray)
options:NSKeyValueObservingOptionNew|
NSKeyValueObservingOptionOld
observer:nil];
[s subscribeNext:^(RACTuple *x){
NSLog(@"x:%@", x);
}];
self.mutableArray = [NSMutableArray new];
NSMutableArray *proxyArray = [self mutableArrayValueForKey:@keypath(self, mutableArray)];
[proxyArray addObject:@"1"];
[proxyArray addObject:@"2"];
[proxyArray addObject:@"3"];
[proxyArray addObject:@"4"];
[proxyArray removeLastObject];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment