Created
May 26, 2014 17:00
-
-
Save LutherBaker/3ce6eedf836516772c2a to your computer and use it in GitHub Desktop.
Objective-C Cheatsheet
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
// | |
// Sharing an instance | |
// | |
+ (id)sharedInstance { | |
static SharedInstanceClass *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