Created
October 8, 2013 16:06
-
-
Save cconstable/6887103 to your computer and use it in GitHub Desktop.
Generic Obj-C Singleton Code Snippet
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
+ (instancetype)sharedUtilities | |
{ | |
__strong static id sharedUtilities; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedUtilities = [[self alloc] init]; | |
}); | |
return sharedUtilities; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment