Skip to content

Instantly share code, notes, and snippets.

@PaulChana
Last active August 29, 2015 14:24
Show Gist options
  • Save PaulChana/4af67d0d5e0170c533cb to your computer and use it in GitHub Desktop.
Save PaulChana/4af67d0d5e0170c533cb to your computer and use it in GitHub Desktop.
Static variable init
+ (NSColor *) staticColour {
__strong static NSColor* _sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedInstance = [NSColor colorWithCalibratedRed:255.f green:255.f blue:255.f alpha:1.0];
});
return _sharedInstance;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment