Skip to content

Instantly share code, notes, and snippets.

@gonzalezreal
Created October 24, 2012 07:02
Show Gist options
  • Select an option

  • Save gonzalezreal/3944472 to your computer and use it in GitHub Desktop.

Select an option

Save gonzalezreal/3944472 to your computer and use it in GitHub Desktop.
+ (NSFetchRequest *)fetchRequestForTwitterUserWithIdentifier:(NSNumber *)identifier
{
static dispatch_once_t onceToken;
static NSPredicate *predicateTemplate;
dispatch_once(&onceToken, ^{
predicateTemplate = [NSPredicate predicateWithFormat:@"identifier == $IDENTIFIER"];
});
NSPredicate *predicate = [predicateTemplate predicateWithSubstitutionVariables:
[NSDictionary dictionaryWithObject:identifier forKey:@"IDENTIFIER"]];
NSFetchRequest *fetchRequest = [self fetchRequest];
[fetchRequest setPredicate:predicate];
return fetchRequest;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment