#define ANIMATION_DURATION 0.4
This has no type information and ANIMATION_DURATION is replaced with 0.4 in every header file it is placed. Somebody can easily redefine same key by mistake.
Instead of this, if you want to use constant in only one file:
static const NSTimeInterval kAnimationDuration = 0.3;
const means you can not change value. static means this definition is only for this class so you can define in another file with same name.
If you want to create a global const:
in header file:
extern NSString *const ClassNameConstantName;
implementation file:
NSString *const ClassNameConstantName = @”Hasancan”;
Here *const means that it is a constant pointer to an NSString so it can not point to another NSString. extern keyword tells the compiler that this symbol resides in global symbol table.
Another example:
extern const NSTimeInterval ClassNameConstantName;
const NSTimeInterval ClassNameConstantName = 0.4;
