I’m programming an iPhone app and have my constants arranged in Constants.h and Constants.m file as recommended in this question: Constants in Objective-C.
My question is, if I define a typedef enum in Constants.h, and want to declare a property of that typedef enum in one of my classes .h files, what is the correct methodology for implementing that? Do I need to move the typedef enum out of Constants.h and in the classes .h file? Seems to defeat the purpose of having a global constants file…
A
typedefcreates a name that you can use as a type, likeint,BOOL, or any other type: it’s a type _def_inition. The compiler just needs to be able to see thetypedefwherever you want to declare a variable of that type. That means all you need to do is import your Constants.h to the file where you want to use the type: