In Objective-C, many classes have mutable and immutable variations. For immutable NSArrays, there may be performance or memory benefits, but if you need an array that you can modify, just use NSMutableArray. There is no reason for concern or concern. This is what they are for.
You can initialize mutable arrays with the given capabilities, although you are not forever attached to this capacity - if necessary, the size of the array will increase beyond the capabilities.
int numberOfItems = ... NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:numberOfItems];
Any optimization benefit available to NSArray depends on its immutable nature. Thus, the syntax aside, you cannot realize the advantages of an immutable object when what you need for actual use is changed (for example, you need to replace objects in your case).
source share