Skip to content

Instantly share code, notes, and snippets.

@jeremytregunna
Forked from pita5/gist:2713702
Created May 16, 2012 20:31
Show Gist options
  • Save jeremytregunna/2713715 to your computer and use it in GitHub Desktop.
Save jeremytregunna/2713715 to your computer and use it in GitHub Desktop.
+ (Foo*)foo
{
static dispatch_once_t pred;
static Foo* shared = nil;
dispatch_once(&pred, ^{
shared = [[Foo alloc] init];
});
return shared;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment