views:

32

answers:

0

I have an Xcode project with two targets for two different apps. There are a lot of #ifdef statements sprinkled throughout the code

#ifdef PROJECT_ONE
    NSArray *dbKeys = [[NSArray alloc] initWithObjects:
                       @"name", @"zip", @"phone", nil];
#else
    NSArray *dbKeys = [[NSArray alloc] initWithObjects:
                       @"name", @"zipcode", @"telephone", nil];
#endif

I'd like to get rid of these and just use global constants. Each target would get it's own file of constants included and I could use NSArray *dbKeys = DATABASE_KEYS; instead of the #ifdef.

Is this a good approach? Where should I import this file? What's the best way to code this "global constants" file? Thanks.