Skip to content

Instantly share code, notes, and snippets.

@augustjoki
Created July 2, 2009 18:57
Show Gist options
  • Save augustjoki/139641 to your computer and use it in GitHub Desktop.
Save augustjoki/139641 to your computer and use it in GitHub Desktop.
static Singleton *singleton = nil;
+ (Singleton *) sharedService {
@synchronized(self) {
if (singleton == nil) {
[[self alloc] init]; // assignment not done here
}
}
return singleton;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment