Skip to content

Instantly share code, notes, and snippets.

@siberianisaev
Created February 13, 2014 06:50
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 siberianisaev/8970931 to your computer and use it in GitHub Desktop.
Save siberianisaev/8970931 to your computer and use it in GitHub Desktop.
Singleton snippet for Xcode 5
+ (<#Class name#> *)<#Singleton method#>
{
static <#Class name#> *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[<#Class name#> alloc] init];
});
return sharedInstance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment