Created
October 25, 2013 23:45
-
-
Save priore/7163531 to your computer and use it in GitHub Desktop.
How to use GDC for create a singleton class
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 dispatch_once_t once; | |
| static id instance; | |
| dispatch_once(&once, ^{ | |
| instance = self.new; | |
| }); | |
| return instance; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment