Skip to content

Instantly share code, notes, and snippets.

@olibob
Last active January 1, 2016 01:49
Show Gist options
  • Save olibob/8075508 to your computer and use it in GitHub Desktop.
Save olibob/8075508 to your computer and use it in GitHub Desktop.
#import "classname.h"
@interface classname ()
@end
@implementation classname
+(classname *)instance {
static dispatch_once_t onetime;
static classname *shared = nil;
dispatch_once(&onetime, ^{
shared = [[classname alloc] init];
});
return shared;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment