TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Apache 2 |
ReleasedLast Release | Dec 2014 |
Maintained by Peyman Oreizy.
Anyone who has profiled scroll performance of a UITableView whose cells render dates knows
how slow it is create NSDateFormatter
instances. CZDateFormatterCache
creates a global
cache of NSDateFormatter
instances -- created the first time you use the cache -- that
can be shared by all of your UI code, as in:
NSDate *date = ...;
cell.detailTextLabel.text = [[CZDateFormatterCache mainThreadCache] localizedStringFromDate:date dateStyle:kCFDateFormatterShortStyle timeStyle:kCFDateFormatterShortStyle];
Since NSDateFormatter
instances are not thread safe, you should only use the cache from the
"main" thread. In fact, CZDateFormatterCache
asserts if you try to use the cache from another
thread.
CZDateFormatterCache was created by Peyman Oreizy and Brian Cooke in the development of CareZone Mobile for iOS.
Peyman Oreizy @peymano
Brian Cooke @bricooke
CZDateFormatterCache is available under the Apache 2.0 license. See the LICENSE file for more info.