Skip to content

Instantly share code, notes, and snippets.

View meadlai's full-sized avatar
🌴
On vacation

meadlai meadlai

🌴
On vacation
  • @Hangzhou, Zhejiang China
View GitHub Profile
@meadlai
meadlai / Singleton Instance in Objective-C
Created December 20, 2012 08:24
Singleton Instance in Objective-C
#pragma mark
#pragma mark Singleton Instance--
static AppManager *sharedSingleton_ = nil;
// Get the shared instance and create it if necessary.
+ (AppManager *) sharedInstance{
if (sharedSingleton_ == nil){
@synchronized(self){
//double checking.
if (sharedSingleton_ == nil) {