It’s requied to create a category with a new variable (of type NSArray).
OriginalClass+Extension.h:
@interface OriginalClass (Extension) {
NSArray *_array;
}
@property (nonatomic, retain) NSArray *array;
@end
But I got the error: Cannot declare variable inside @interface or @protocol.
Please help to solve the problem.
As the other stated, you can’t. Although has H2CO3 pointed out, you can use associative references. On Apple Documents:
If you want to go for associated object, you can use this answer. Moreover, you can use this post by Ole Begemann.