xcode - How to declare a function in Cocoa after the function using it? -


I am slowly making my work in a working state.

I am using two functions: Set Collection and addToCollection . These tasks accept both NSArray as input.

I also have a function named add , in which I use both of these functions when I try to compile, Xcode shows an error:

'setCollection' undeclared (first use in this function)

I think the function is to be defined below the function of an active function And the guess would be that the functions inside my add function can be used Land.

I'm usually a php coder the way PHP handles it is first. Called functions must be before using those functions, because otherwise they do not exist. Is the work still a way to be available at runtime, or should I work properly to rearrange all the functions?

If your functions are global (not part of a class), then you have to give a declaration in advance Experiments are used like ezams.

If your work is actually methods (part of the class), before implementing you must declare an ignorant class of your class and put your method announcements in this interface:

< Previous> @ interface miklas () - (zero) set calling: array (NSARRA *); - (zero) addToCollection: (NSArray *) array; @end @ Implementation MyCalus // code which calls call calling or add-techlation - (zero) set calling: (NSERRE *) array {// your code here} - (zero) addToCollection: (NSArray *) array {// Your code here} @ << Code>

In this way, you should MyClass .

does not need to expose your work in the main interface.

Comments