Create a gist now

Instantly share code, notes, and snippets.

Using block-based dictionary enumeration to find a matching key
__block Foo *result = nil;
[dictionary enumerateKeysAndObjectsUsingBlock:^(id aKey, id anObject, BOOL *stop) {
BOOL matches = ... // test if key meets requirements here
if (matches)
{
result = anObject;
*stop = YES;
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment