Skip to content

Instantly share code, notes, and snippets.

@cconstable
Created October 8, 2013 16:06
Show Gist options
  • Save cconstable/6887103 to your computer and use it in GitHub Desktop.
Save cconstable/6887103 to your computer and use it in GitHub Desktop.
Generic Obj-C Singleton Code Snippet
+ (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