Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@luckyduck
Last active December 19, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luckyduck/5889677 to your computer and use it in GitHub Desktop.
Save luckyduck/5889677 to your computer and use it in GitHub Desktop.
//Singleton.h
+ (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