Skip to content

Instantly share code, notes, and snippets.


luckyduck/iOS Singleton

Last active Dec 19, 2015
What would you like to do?
+ (id) sharedInstance;
// singleton.m
+ (id)sharedInstance {
static BackendResource *shared = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[self alloc] init];
return shared;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.