NSString *hashKey = [NSString stringWithFormat:@"%lu%lu%lu", (unsigned long)format.hash, (unsigned long)timeZone.hash, (unsigned long)locale.hash];
NSDateFormatter *formatters = [NSDate sharedDateFormatters];
NSDateFormatter *cachedDateFormatter = formatters[hashKey];
I am having trouble with this line:
NSDateFormatter *cachedDateFormatter = formatters[hashKey];
Tells me: expected method to read dictionary element not found on object of type "NSDateFormatter*"
Some context:
+ (NSMutableDictionary<NSString *, NSDateFormatter *>*)sharedDateFormatters {
static NSMutableDictionary *dict = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
dict = [NSMutableDictionary new];
});
return dict;
}