I am reading a book on Objective-C, paragraph dedicated to the global variables.
Author uses the following example:
For class Employee
In .h file declare:
extern NSString const *greeting;
In .m file declare
NSString const *greeting = @"Hello";
Author however does not mention the need for
@property (strong, readonly) NSString const *greeting;
and @synthesize greeting;
Am i missing something and there is a way to avoid it, or was that a typo on the author’s part?
@property is for instance variables; global variables are not specific to an instance of a class. Even then, you do not need to use @property, even for instance variables.