Skip to content

Instantly share code, notes, and snippets.

@mmassaki
Created September 24, 2012 00:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmassaki/3773649 to your computer and use it in GitHub Desktop.
Save mmassaki/3773649 to your computer and use it in GitHub Desktop.
Objective-C Singleton (With ARC)
+ (id)sharedInstance
{
static class *sharedInstance;
static dispatch_once_t done;
dispatch_once(&done, ^{
sharedInstance = [class new];
});
return sharedInstance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment