Skip to content

Instantly share code, notes, and snippets.

@mpurbo
Created March 11, 2013 01:10
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 mpurbo/5131291 to your computer and use it in GitHub Desktop.
Save mpurbo/5131291 to your computer and use it in GitHub Desktop.
GCD for static array of objects.
static NSArray *objectRegistry;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
objectRegistry = [[NSArray alloc] initWithObjects:obj1, obj2, nil];
});
return objectRegistry[index];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment