Skip to content

Instantly share code, notes, and snippets.

@michaelochs
Last active December 17, 2015 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelochs/5566888 to your computer and use it in GitHub Desktop.
Save michaelochs/5566888 to your computer and use it in GitHub Desktop.
Shared Dateformatter for performance optimization
+ (instancetype)uiDateFormatter
{
static NSDateFormatter* uiDateFormatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
uiDateFormatter = [[NSDateFormatter alloc] init];
uiDateFormatter.dateStyle = NSDateFormatterFullStyle;
uiDateFormatter.timeStyle = NSDateFormatterNoStyle;
});
return uiDateFormatter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment