Created
April 13, 2013 19:52
-
-
Save colemancda/5379799 to your computer and use it in GitHub Desktop.
Singleton Implementation
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
+ (<#Class#> *)shared<#short class name#> | |
{ | |
static <#Class#> *shared<#short class name#> = nil; | |
if (!shared<#short class name#>) { | |
shared<#short class name#> = [[super allocWithZone:nil] init]; | |
} | |
return shared<#short class name#>; | |
} | |
+ (id)allocWithZone:(NSZone *)zone | |
{ | |
return [self shared<#short class name#>]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment