I have a constant in one class that I want to access from another.
I want to access these:
#define kStateRunning 1
#define kStateGameOver 2
#define kStateMenu 3
which are in my GameController.h from Level1.m. In Level1.h I have @class GameController as well as an import in the implementation file.
I tried searching for an answer, but I’m not sure if I’m wording all this correctly.
If you use
#define myConstant,myConstantwill be known since you import your file. Define them at the beginning of yourGameController.hbetween the import and the@Interfacefor example.Then if you import
GameController.hin one of your other files (let’s takeLevel1.mfor example). You can use it, without prefixing it. Just usemyConstant