Wednesday, December 14, 2011

Simple constants in Objective C

At this point, we just want to implement a bit of date manipulation logic.

If the user had less than 5 seconds remaining before returning the question, then we want to use a shorter amount of days - call it "SLOW_RESPONSE_INTERVAL_DAYS". Otherwise, we'll use "FAST_RESPONSE_INTERVAL_DAYS;

In the Android, it looks like this:


static final int SLOW_RESPONSE_INTERVAL_DAYS = 3;
static final int FAST_RESPONSE_INTERVAL_DAYS = 5;

In iOS, pretty much is seems like defines are used...

#define SLOW_RESPONSE_INTERVAL_DAYS 3
#define FAST_RESPONSE_INTERVAL_DAYS 5

We'll keep it inside the class where we're processing the spaced repetition logic, so that ought to be sufficient for our needs.

No comments:

Post a Comment