Last active
September 20, 2015 22:10
-
-
Save AdityaDeshmane/6d58610f5ce0455568bb to your computer and use it in GitHub Desktop.
iOS : Singleton Class
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
static DataManager* dataManager = nil ; | |
#pragma mark - Singlton instance creation | |
+(void)initialize | |
{ | |
if (!dataManager) | |
{ | |
dataManager = [[DataManager alloc] init] ; | |
} | |
} | |
+(DataManager *)sharedManager | |
{ | |
return dataManager; | |
} | |
-(id) init | |
{ | |
if (nil == dataManager) | |
{ | |
dataManager = [super init]; | |
} | |
return dataManager ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment