I need to use something like a C array:
MyStruct theArray[18][18];
but I cannot define it as a property:
@property (nonatomic) MyStruct theArray[18][18];
then I have to:
@implementation MyClass
{
MyStruct theArray[18][18];
}
But is this good in term of modern Objective C guideline?
Thanks
Update:
I know I can define the struct as class and use NSMutableArray to handle it, but it is more convenient to use the C array in my case, the main concern is coding guideline and memory issue, as I do not allocate or release the theArray[18][18], not sure what its life cycle is, and I’m using ARC.
Properties cannot be of array type, while public instance variables do not provide sufficient encapsulation. A more Objective C – like approach would be defining a private 2D array, and a pair of methods or a method returning a pointer to access it – something along these lines: