I\'m developing a Cocoa application, and I\'m using constant NSString
s as ways to store key names for my preferences.
I understand this is a good idea b
There is also one thing to mention. If you need a non global constant, you should use static
keyword.
Example
// In your *.m file
static NSString * const kNSStringConst = @"const value";
Because of the static
keyword, this const is not visible outside of the file.
Minor correction by @QuinnTaylor: static variables are visible within a compilation unit. Usually, this is a single .m file (as in this example), but it can bite you if you declare it in a header which is included elsewhere, since you'll get linker errors after compilation