Created
March 11, 2013 01:10
-
-
Save mpurbo/5131291 to your computer and use it in GitHub Desktop.
GCD for static array of objects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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