Skip to content

Instantly share code, notes, and snippets.

@sdpjswl
Last active August 29, 2015 14:06
Show Gist options
  • Save sdpjswl/f1e939f3b426a4d80e29 to your computer and use it in GitHub Desktop.
Save sdpjswl/f1e939f3b426a4d80e29 to your computer and use it in GitHub Desktop.
Singleton class
+ (instancetype)sharedManager {
static ClassName *sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedManager = [[self alloc] init];
});
return sharedManager;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment