Skip to content

Instantly share code, notes, and snippets.

@zarochintsev
Created June 21, 2019 14:08
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 zarochintsev/298b9336b17a4f7899e62c2e82eac266 to your computer and use it in GitHub Desktop.
Save zarochintsev/298b9336b17a4f7899e62c2e82eac266 to your computer and use it in GitHub Desktop.
#import "Singleton.h"
@implementation Singleton
+ (id)shared {
static Singleton *shared = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[self alloc] init];
});
return shared;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment