Skip to content

Instantly share code, notes, and snippets.

@SergioEstevao
Last active December 20, 2015 15:39
Show Gist options
  • Save SergioEstevao/6156325 to your computer and use it in GitHub Desktop.
Save SergioEstevao/6156325 to your computer and use it in GitHub Desktop.
iOS generic sharedInstance implementation
+ (instancetype) sharedInstance {
static id _sharedInstance = nil;
static dispatch_once_t _onceToken;
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