Created
June 21, 2019 14:08
-
-
Save zarochintsev/298b9336b17a4f7899e62c2e82eac266 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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