Skip to content

Instantly share code, notes, and snippets.

@palmtrae
Created December 18, 2013 14:15
Show Gist options
  • Save palmtrae/8023023 to your computer and use it in GitHub Desktop.
Save palmtrae/8023023 to your computer and use it in GitHub Desktop.
Singleton
+ (instancetype)sharedConnector
{
static TcpConnector * sharedConnector;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedConnector = [TcpConnector new];
});
return sharedConnector;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment