Created
January 11, 2018 10:15
-
-
Save YauzZ/6f267777c57e0a51a269995bf9d49788 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
+ (instancetype)shareInstance | |
{ | |
static id instance = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
instance = [[self alloc] init]; | |
}); | |
return instance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment