RosettaCodeData/Task/Singleton/Objective-C/singleton-3.m

11 lines
235 B
Objective-C

+ (SomeSingleton *) sharedInstance
{
static SomeSingleton *sharedInstance = nil;
@synchronized(self) {
if (!sharedInstance) {
sharedInstance = [[SomeSingleton alloc] init];
}
}
return sharedInstance;
}