Objective-C Language NSMutableArray Creating an NSMutableArray


Example

NSMutableArray can be initialized as an empty array like this:

NSMutableArray *array = [[NSMutableArray alloc] init];
// or
NSMutableArray *array2 = @[].mutableCopy;
// or
NSMutableArray *array3 = [NSMutableArray array];

NSMutableArray can be initialized with another array like this:

NSMutableArray *array4 = [[NSMutableArray alloc] initWithArray:anotherArray];
// or
NSMutableArray *array5 = anotherArray.mutableCopy;