When you do
myClass.m
@interface myClass {
NSMutableArray *myArray;
}
@end
@implement
.....
.....
What is the purpose when you are trying declare a variable like this.
How it looks differently when you declare
myClass.h
@import "UIKit/UIKit.h"
@interface myClass () <TableViewDataSource>
NSMutableArray *myArray
@end
Thanks
The first example is the declaration of an instance variable.
The second is using a property.
There are differences between the two. For example, when using an instance variable, you have to write your own getters/setters. With property, you do not.
There are more differences and great detail can be found here: Declared Properties Documentation
Updated given changes to original question.
Assuming you’re talking about the myArray variable, in the first example, you’ve declared myArray as an instance variable of a class. To access it, you’d need to create an instance of the class.
In the second example, you’ve declared it as a global variable which by default has file scope. That is to say, you could use it in any file which includes the myclass.h header, without the need to create an instance of the class. However, you do have to be careful about including it in multiple files, or you could end up with multiple definition errors.