Created
November 5, 2012 11:53
-
-
Save newmarcel/4016847 to your computer and use it in GitHub Desktop.
GCD-based Singleton
This file contains hidden or 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
+ (id)sharedManager | |
{ | |
static dispatch_once_t once = 0; | |
static id sharedInstance = nil; | |
dispatch_once(&once, ^{ | |
sharedInstance = [self alloc] init]; | |
}); | |
return sharedInstance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment