-1

I wish to collect all the needed parameters/constants, structs, and enums in one separate file, so that I can easily find and edit them later. How can I achieve this goal?

I tried to put them in a separate .m file, and add this file to the current compile target. But it did not work. My .m file is as follows

#import <Foundation/Foundation.h>

NSTimeInterval const oneDay=86400;
NSTimeInterval const oneSecond=1;

typedef enum:NSUInteger {
    EventStatusPassed,
    EventStatusFinished,
} EventStatus;

Thank you

Reinier Melian
  • 20,519
  • 3
  • 38
  • 55
D.Yao
  • 1
  • 1

1 Answers1

1

Constants.h file

@interface Constants : NSObject
    extern NSString* const URL;
@end

Constants.m file

@implementation Constants
    NSString* const someConstant = @"abcd";
@end

and import it in the files that you need constants

#import "Constants.h"
NTP
  • 4,338
  • 3
  • 16
  • 24