I've been reading some tutorials on raywenderlich.com, and came across this block of code...
_players = [NSMutableArray arrayWithCapacity:20];
Player *player = [[Player alloc] init];
player.name = @"Bill Evans";
player.game = @"Tic-Tac-Toe";
player.rating = 4;
[_players addObject:player];
player = [[Player alloc] init];
player.name = @"Oscar Peterson";
player.game = @"Spin the Bottle";
player.rating = 5;
[_players addObject:player];
player = [[Player alloc] init];
player.name = @"Dave Brubeck";
player.game = @"Texas Hold’em Poker";
player.rating = 2;
[_players addObject:player];
Even if the project is using ARC, isn't this bad code? Re-allocating and initialing the variable? Shouldn't it be allocated once and then reference a method within the class that prepares the variable for reuse by wiping the existing data?
playervariable if that is what you are asking about.