How can I create an array of certain times?

NSDate * date = [NSDate date];
NSArray * array = @[];
NSUInteger index =
[array indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
    return ![[((NSDate *)obj) earlierDate:date] isEqualToDate:date];
}];
NSDate * refDate = nil;

if (index != NSNotFound)
    refDate = array[index];

Leave a Comment