Created
July 12, 2012 10:09
-
-
Save fousa/3097175 to your computer and use it in GitHub Desktop.
GCD Singleton
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
+ (MyClass *)sharedInstance { | |
static dispatch_once_t _predicate; | |
static MyClass *_sharedInstance = nil; | |
dispatch_once(&_predicate, ^{ | |
_sharedInstance = [self new]; | |
}); | |
return _sharedInstance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment