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

c - zlib and gdi32 with OpenSSL? -

java - inputmismatch exception -

ios - Align baselines with characters in large line heights with Text Kit -