I’ve often read about the desirability of splitting large (monolithic?) blocks of app code up into separate source code files to make it easier to maintain etc., but I haven’t yet seen anything explaining exactly how to do this.
The process of creating separate files is straightforward enough when adding a subclass of course — and that’s a good example of what I’m trying to achieve — but what if we only have ONE controller object and we wanted to split our code into say, (1) an interface and implementation file group containing only methods for calculating things and (2) another pair containing only printing-related methods, but have each method be able to access all other methods as if they were all still in the one (source) file.
Any detailed advice on how to go about this (if it’s possible) would be much appreciated. Thanks 🙂
This is best done through use of categories. For example, make a header file called MyController+Printing.h:
and the implementation file MyController+Printing.m:
Look in Apple’s header files for great examples of this technique.