If I have an NSMutableArray with 10 objects
I run this line of code
[tempArray removeObjectAtIndex:0];
then
[tempArray count]
should return 9
but does the entire Array shift up
Object At Index 1 moves to Index 0
Object at Index 2 moves to Index 1
...
Object at Index 9 moves to Index 8
or is Index 0 = nil?
The NSMutableArray class declares the programmatic interface to objects that manage a modifiable array of objects. This class adds insertion and deletion operations to the basic array-handling behavior inherited from NSArray .
NSArray is an immutable Objective C class, therefore it is a reference type in Swift and it is bridged to Array<AnyObject> . NSMutableArray is the mutable subclass of NSArray .
From the NSMutableArray documentation:
To fill the gap, all elements beyond index are moved by subtracting 1 from their index.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With