I'm starting my adventure with Objective-C
and iOS
and I've got one thing that I don't know how to use correctly and this is literally blowing my mind.
Many tutorials have private class variables in .m
files defined like this:
@interface ViewController (){
@property (nonatomic, strong) NSMutableArray *myArray;
}
or like this:
@implementation ViewController
NSMutableArray *myArray;
@end
In the first example I can use _myArray
instead of self.myArray
, which I like, but should I put all my private variables in interface files? What's the difference between those two variables? When should I use one instead of another, and which is safer?