Skip to content

Instantly share code, notes, and snippets.

@mikeabdullah
Created August 29, 2012 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeabdullah/3515355 to your computer and use it in GitHub Desktop.
Save mikeabdullah/3515355 to your computer and use it in GitHub Desktop.
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