Skip to content

Instantly share code, notes, and snippets.

@shabib87

shabib87/Singleton.m

Last active Feb 24, 2017
Embed
What would you like to do?
@implementation Singleton
+ (instancetype)sharedInstance {
static Singleton *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[Singleton alloc] init];
});
return sharedInstance;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment