objective c - What are the differences between [[NSMutableArray alloc] init] and [@[] mutableCopy]? -


nsmutablearray *myarray = [[nsmutablearray alloc] init]; 

vs

nsmutablearray *myarray = [@[] mutablecopy] 

what differences between declaring arrays in these 2 separate ways?

think of 2nd line as:

nsmutablearray *myarray = [[[nsarray alloc] init] mutablecopy]; 

so clear difference 1st way more efficient , 2nd way needlessly creates object promptly discarded.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -