i.e. I want to bring this in my code:
static BOOL MyConstantBool = YES;
Must it be before or after @implementation? Are there rules where t
If it's after the @implementation
block, then you can't use it in the @implementation
block (unless it's been forward declared somewhere else using extern
). Here's how I do it:
//Constants.h
extern BOOL MyConstantBool;
extern NSString* MyConstantString;
//Constants.m
#import "Constants.h"
BOOL MyConstantBool = YES;
NSString* MyConstantString = @"Hello, world!";
//SomeOtherFile.m
#import "Constants.h"
//you can now use anything declared in Constants.h