Skip to content

Instantly share code, notes, and snippets.

@sparga
Created April 22, 2014 10:24
Show Gist options
  • Save sparga/11173275 to your computer and use it in GitHub Desktop.
Save sparga/11173275 to your computer and use it in GitHub Desktop.
Formatters Snippets
+ (NSNumberFormatter *)<#formatterName#>
{
NSMutableDictionary *threadDict = [[NSThread currentThread] threadDictionary];
NSNumberFormatter *aFormatter = [threadDict objectForKey:NSStringFromSelector(_cmd)];
if(nil == aFormatter) {
aFormatter = [[NSNumberFormatter alloc] init];
NSLocale *parisLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"fr"];
[aFormatter setLocale:parisLocale];
<#formatterConfiguration#>
[threadDict setObject:aFormatter forKey:NSStringFromSelector(_cmd)];
}
return aFormatter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment