inessential by Brent Simmons

How I did a Lite version of my app

I figured it would be worth noting how I managed full and Lite versions of the same app, for the benefit of any Cocoa programmers considering the same thing.

It’s pretty simple, actually.

1. I had a separate target (named NetNewsWire Lite) inside the same project. (The easiest way to get started is probably to duplicate your existing target.)

2. In the Xcode toolbar I made sure the Active Target popup was visible. (So I could switch between targets easily.)

3. In the Groups & Files list, I enabled the Target Membership column, so I could set which files were included in which targets. (Ctrl-click, or right-click, on the Groups & Files header.)

4. Each target had a separate Prefix Header setting. (proprefix.h and liteprefix.h)

5. Instead of just defining #LITE in the prefix header, I did separate #defines per feature. (Not for every feature, but for features that may not appear in the Lite version.)

For instance, proprefix.h has lines like this:

#define FIND 1
#define COLUMN_DATE 1


While liteprefix.h has lines like this:

#define FIND 0
#define COLUMN_DATE 1


Then, in the right places in the code, I used those.

#if FIND
    [do findy things here]

The reason to do this on a per-feature basis is because it makes it easy to change your mind. For instance, one day I decided that the Lite version should get a date column, and I just edited liteprefix.h and rebuilt.

Easy? Yep.

Update: I bet I got the per-feature-#defines from working on Frontier.