Created
July 25, 2017 06:49
-
-
Save leilee/636ecf289b6c421ec764d9c02031d667 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
+ (id)sharedInstance | |
{ | |
static __weak ASingletonClass *instance; | |
ASingletonClass *strongInstance = instance; | |
@synchronized(self) { | |
if (strongInstance == nil) { | |
strongInstance = [[[self class] alloc] init]; | |
instance = strongInstance; | |
} | |
} | |
return strongInstance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment