Last active
January 2, 2016 16:39
-
-
Save EvgenyKarkan/8331475 to your computer and use it in GitHub Desktop.
Singleton.
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
#pragma mark Singleton stuff | |
static id _sharedInstance; | |
+ (EKCoreDataProvider *)sharedInstance | |
{ | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_sharedInstance = [[EKCoreDataProvider alloc] init]; | |
}); | |
return _sharedInstance; | |
} | |
+ (id)allocWithZone:(NSZone *)zone | |
{ | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_sharedInstance = nil; | |
_sharedInstance = [super allocWithZone:zone]; | |
}); | |
return _sharedInstance; | |
} | |
- (id)copyWithZone:(NSZone *)zone | |
{ | |
return self; | |
} | |
+ (id)new | |
{ | |
NSException *exception = [[NSException alloc] initWithName:kEKException | |
reason:kEKExceptionReason | |
userInfo:nil]; | |
[exception raise]; | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment