cocoa - Segmenting code into multiple source files -


I have often read about the desirability of the large (monolithic) block of app code sharing, in separate source code files Make it easy to maintain, but I have not understood anything yet how to do it.

The process of creating separate files when adding subclass of course is simple - and a good example of what I am trying to achieve - but what if we only have one controller object and we Code (1) Interface and implementation file group in which only methods are used to calculate things and (2) only printing-related methods And pair, but prefix A method may be able to reach all other methods as if they are all in the same (source) file.

Any detailed advice about this (this is possible) will be greatly appreciated. Thank you: -)

This is best done through the use of categories, for example, MyController + Print.h:

#import Create a header file named "MyController.h" @ MyController (Printing Support) - (Zero) Print: (ID) Sender; @end

and the MyController + printing.m implementation file:

  #import "MyController + Printing.h" @implementation MyController (Printing Support) - ( Zero) Print: (ID) sender {} @ and  

For great examples of this technique, refer to the header files in the applet.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -