I have an enum defined in the Constants.h file this way:
typedef enum {
CalendarTypeMonth = 0,
CalendarTypeWeek
} CalendarType;
Then in my view controller I determine what the calendar type should be and store it in a property this way:
@property (nonatomic) CalendarType myCalendarType;
Now I want all the classes in my project have access to the calendar type. How can I set this property to be global/extern so that all classes can read this?
EDIT: I know the definition of the enum will be available across the project. But what I am interested in is the value of myCalendarType. How can I access the value of myCalendarType across all classes?
You can declare class method to access static variable.
Add such code to your implementation file:
And create declarations for this methods in interface file.
This is much better then moving all static values to AppDelegate.
Anyway, a lot of variants are possible – for example, you can create singletone to store some settings of application or use CoreData.