I am using an open source component in my iOS project (sharekit), and they defined static variables in the header file. For example, in SHKConfig.h
they define the App Name as:
#define SHKMyAppName @"My App Name"
What I would like to do is make this dynamic; I don't want to hard-code those variables in that specific file. Since there is obviously no viewDidLoad
method in a header file (as far as I know), how could I possibly dynamically assign this variable?
Is this even possible?
Thank you very much in advance!!!
#define
is always evaluated during code compilation. You should modify the library to get this functionality.
Another solution is the following. Create some class Provider
with a
+ (NSString *)getYourConstant;
method and use the following macro
#import "Provider.h"
#define kTheConstantYouNeed [Provider getYourConstant]