Created
March 19, 2014 15:51
-
-
Save patzearfoss/9644671 to your computer and use it in GitHub Desktop.
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
/// .h | |
@interface mySingleton : NSObject | |
@property (nonatomic, strong) id someData; | |
+ (id)sharedInstance; | |
+ (void)probablySuperfluousStartup; | |
+ (void)probablyUnnecessaryShutdown; | |
@end | |
/// .m | |
static mySingleton *sharedInstance; | |
@implemenation mySingleton | |
+ (void)startup | |
{ | |
[self sharedInstance]; | |
} | |
+ (void)shutdown | |
{ | |
self.someData = nil; | |
} | |
+ (id)sharedInstance | |
{ | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedInstance = [[self alloc] init]; | |
}); | |
return sharedInstance; | |
} | |
- (instanceType)init | |
{ | |
self = [super init]; | |
if (self) | |
{ | |
_someData = [NSObject new]; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment