<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMutableArray/removeObjects(at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMutableArray(im)removeObjectsAtIndexes:"
  },
  "title" : "removeObjects(at:)"
}
-->

# removeObjects(at:)

Removes the objects at the specified indexes from the array.

```
func removeObjects(at indexes: IndexSet)
```

## Parameters

`indexes`

The indexes of the objects to remove from the array. The locations specified by `indexes` must lie within the bounds of the array.

## Discussion

This method is similar to [`removeObject(at:)`](/documentation/Foundation/NSMutableArray/removeObject(at:)), but allows you to efficiently remove multiple objects with a single operation. `indexes` specifies the locations of objects to be removed given the state of the array when the method is invoked, as illustrated in the following example:

```objc
NSMutableArray *array = [NSMutableArray arrayWithObjects: @"one", @"a", @"two", @"b", @"three", @"four", nil];
NSMutableIndexSet *indexes = [NSMutableIndexSet indexSetWithIndex:1];
[indexes addIndex:3];
[array removeObjectsAtIndexes:indexes];
NSLog(@"array: %@", array);
 
// Output: array: (one, two, three, four)
```

If `indexes` is `nil`, this method raises an exception.

## See Also

[`-  initWithCapacity:`](/documentation/Foundation/NSMutableArray/init(capacity:))

Returns an array, initialized with enough memory to initially hold a given number of objects.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)