I have a method that looks something like this:
- (RACSignal*)savedObjectsOfEntityType:(NSEntityDescription*)entity
{
return [[[[NSNotificationCenter defaultCenter] rac_addObserverForName:NSManagedObjectContextDidSaveNotification object:nil] map:^id(NSNotification *notification) {
NSMutableArray *allSaves = [NSMutableArray array];
[allSaves addObjectsFromArray:notification.userInfo[NSInsertedObjectsKey]];
[allSaves addObjectsFromArray:notification.userInfo[NSUpdatedObjectsKey]];
[allSaves addObjectsFromArray:notification.userInfo[NSDeletedObjectsKey]];
return allSaves;
}] filter:^BOOL(NSArray *allSaves) {
// Can filter only if I get individual objects
}];
}
I am mapping the notification objects returned by an observer on the notification center. Each notification contains several array that I merge together in the allSaves array. On the next step I would need to filter the individual objects in that array. The problem is the object I get from the map is the array of objects and it doesn't make sense to filter on it. Instead I would need the map to send the objects in allSaves one by one. The map operator doesn't do this, but is there another operator that can take an array and pass out individual objects from it one by one?