Concatenation of two arrays in Objective-C

Kiran picture Kiran · Nov 11, 2010 · Viewed 21.5k times · Source

How to concatenate two arrays into a single array in Objective-C?

Answer

Vladimir picture Vladimir · Nov 11, 2010
NSArray* newArray = [firstArray arrayByAddingObjectsFromArray:secondArray];

Or using mutable array version just add to it all objects from another array:

[myMutableArray addObjectsFromArray:secondArray];