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

10 lines
241 B
Mathematica
Raw Permalink Normal View History

2013-06-05 21:47:54 +00:00
+ (SomeSingleton *) sharedInstance
{
static SomeSingleton *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[SomeSingleton alloc] init];
});
return sharedInstance;
}