Skip to content

Instantly share code, notes, and snippets.

@AdityaDeshmane
Last active September 20, 2015 22:10
Show Gist options
  • Save AdityaDeshmane/6d58610f5ce0455568bb to your computer and use it in GitHub Desktop.
Save AdityaDeshmane/6d58610f5ce0455568bb to your computer and use it in GitHub Desktop.
iOS : Singleton Class
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