Last active
December 17, 2015 06:39
-
-
Save michaelochs/5566888 to your computer and use it in GitHub Desktop.
Shared Dateformatter for performance optimization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (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