Created
February 27, 2012 16:21
-
-
Save kluivers/1925063 to your computer and use it in GitHub Desktop.
A singleton implementation in Objective-C
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
+ (id) sharedInstance { | |
static dispatch_once_t predicate = 0; | |
__strong static id shared = nil; | |
dispatch_once(&predicate, ^{ | |
shared = [[self alloc] init]; | |
}); | |
return shared; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment