I'd like to increment over days in a loop, so that it counts 2012-11-10
, 2012-11-11
, 2012-11-12
, …
What's the most performant way to achieve this?
NSDate *iterationDate = [NSDate date];
for (int i = 0; i < 100; i++) {
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setYear:0];
[comps setMonth:0];
[comps setWeek:0];
[comps setDay:1];
[comps setHour:0];
[comps setMinute:0];
[comps setSecond:0];
iterationDate = [currentCalendar dateByAddingComponents:comps toDate:iterationDate options:0];
}