Created
October 30, 2013 23:14
-
-
Save wjlafrance/7241927 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
/** | |
* Creates a dispatch_once style singleton. | |
* | |
* SINGLETON(NSString *awesomeString) | |
* awesomeString = [NSString stringWithFormat:@"%@ %@", @"composed", @"string"]; | |
* SINGLETON_END(awesomeString) | |
*/ | |
#define SINGLETON(name) static name; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ | |
#define SINGLETON_END(name) }); return name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment