- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Date formatter for displaying dates
static NSDateFormatter *dateFormatter = nil;
if(dateFormatter == nil){
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
[dateFormatter setDateFormat:NSDateFormatterMediumStyle];
}
Why do we initialize the dateFormatter variable and then immediately test for it being nil? Ive noticed this a lot in the newer Apple code. Curious!
-Buffalo