views:

29

answers:

0

Hello everybody,

I'm trying to create an iPhone app for helping me managing my class schedule. This means that I will have various subjects recurring regularly at a given time. So I might have one subject recurring every 2 days, whereas another is recurring every 3 weeks. I'm wondering now what the best way to storage this is, so that it can be fetched easily - later, I want to be able to fetch all subjects that take place on a given date.

I thought about saving a semester end date, in addition to a start date and an NSTimeIntervall. When the subject was saved, I would create an array with dates somehow like this:

for (int i = 0; [mostRecentDateInArray compare:semesterEndDate] == NSOrderedAscending; i++) {

   mostRecentDateInArray = [NSDate dateWithTimeIntervalSinceNow:(i*someTimeIntervall)];

   [datesArray addObject:mostRecentDateInArray];
}

But I'm sure there is a better solution than that, I just can't seem to find it. I would appreciate some help :)