This is definitely possible with the NSDictionary block method.
- (NSSet *)keysOfEntriesPassingTest:(BOOL (^)(id key, id obj, BOOL *stop))predicate;
You need to return objects that satisfy some condition (predicate).
Use it as follows:
NSSet *keys = [myDictionary keysOfEntriesPassingTest:^BOOL(id key, id obj, BOOL *stop) { BOOL found = (objectForWhichIWantTheKey == obj); if (found) *stop = YES; return found; }];
Check this answer for more details.
How to specify a block object / predicate required by NSDictionaryAfEntriesPassingTest keys?
valdyr Sep 26 '12 at 14:14 2012-09-26 14:14
source share