With reference to iOS 7 with ARC, is using temp
or tempByProperty
better?
In the .m file:
@interface ViewController ()
@property (weak) NSString *tempByProperty;
@end
@implementation ViewController
NSString *temp;
- (void)viewDidLoad
{
[super viewDidLoad];
temp = @"string1";
temp = @"string2";
self.tempByProperty = @"string1";
self.tempByProperty = @"string2";
}
I've read that we should declare private variables in the .m file. But there seems to be two ways of declaring them (with and without the @property
).
Which one will not cause a memory leak assuming the same variable will be overwritten multiple times with the =
operator?