Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + (instancetype)sharedInstance
- {
- static MyClass *sharedInstance = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- sharedInstance = [[MyClass alloc] init];
- });
- return sharedInstance;
- }
- Singleton *inst1 = [Singleton sharedInstance];
- Singleton *inst2 = [Singleton sharedInstance];
- static MyClass *sharedInstance = nil;
Add Comment
Please, Sign In to add comment