Skip to content

Instantly share code, notes, and snippets.

@blinker13
Last active December 15, 2015 22:19
Show Gist options
  • Select an option

  • Save blinker13/5332224 to your computer and use it in GitHub Desktop.

Select an option

Save blinker13/5332224 to your computer and use it in GitHub Desktop.
Class method for creating and retrieving a unique instance.
+ (instancetype)sharedInstance {
static dispatch_once_t onceToken;
static id sharedInstance;
dispatch_once(&onceToken, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment