I have found many discussions about NSMutableArray vs NSArray.
It’s very interesting and i understand that you cannot add or delete objects inside a NSArray
But is it possible to change objects in a NSArray ?
I mean, if i have a NSArray of NSNumber, can i change the NSNumber in the NSArray or should i use a NSMutableArray to be able to modify values of objects in the NSArray ?
NSArraydoes not let you exchange the elements (nor append or remove them). If you had anNSArrayof mutable objects, sayNSMutableStrings you could modify the objects without changing the array.Since Cocoa does not contain a mutable variant of
NSNumberyou cannot do that with number objects, though.Example:
Long story short:
Yes.