How to convert an NSArray into an NSMutableArray

- by

There’s a handy function called arrayWithArray that we can use:

NSMutableArray *myNewArray = [[NSMutableArray alloc]init];
myNewArray = [NSMutableArray arrayWithArray:myOldArray];

Likewise we can convert a mutable array into a standard one:

NSArray *myStandardArray = [[NSArray alloc]init];
myStandardArray = [NSArray arrayWithArray:myMutableArray];


If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.