Could someone share some knowledge on whats best practice / code convention on using @property iVars in init methods or designated initializers?
please see my example:
@interface MyClass ()
@property(nonatomic,strong) nsstring *tempString;
@property(nonatomic,strong) NSMutableArray *arrItems;
@end
@implementation ViewController
- (id)init
{
if (self = [super init]) {
//Is this best practice / correct
_tempString = @"";
_arrItems = [[NSMutableArray alloc] initWithCapacity:0];
...
...
//Or this
self.tempString = @"";
self.arrItems = [[NSMutableArray alloc] initWithCapacity:0];
}
return self;
}
@end
Any advice on why one or the other should be used?
Thanks...