Created
July 16, 2013 05:09
-
-
Save danmartyn/6005946 to your computer and use it in GitHub Desktop.
Singleton for Obj-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
+ (<#Class#> *)sharedManager | |
{ | |
static <#Class#> *sharedManager = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedManager = [[<#Class#> alloc] init]; | |
// other initialisation stuff | |
}); | |
return sharedManager; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment