Created
April 27, 2017 07:31
-
-
Save vlchapaev/7d7da9997bfc3c6831e57269e6ca2194 to your computer and use it in GitHub Desktop.
Objective-C Shared instance
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
+ (instancetype)sharedInstance { | |
static Instance *sharedInstance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedInstance = [[Instance alloc] init]; | |
}); | |
return sharedInstance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment