iphone - Is it good to define all the constants in one file or in header file of the class being used in? -


in objective c, practice define constants in 1 constanst.h file or putting constants in .h file of classes used.

what general convention ?

for example:

shall define enums used in custom view in .h file of view or in 1 central file. in cases have constants hostname , routes apis, should in module of class interfacing api or again in central file.

i use constants.h/.m file constants shared multiple classes. (e.g constants nsuserdefaults or nsnotificationcenter)

for constants needed in 1 class define them class. (e.g. cell_height)

morover, use constants.h , import in name-prefix.pch automatically imported classes.


Comments