---
title: "removeObjects(at:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutablearray/removeobjects(at:)"
---

# removeObjects(at:)

Removes the objects at the specified indexes from the array.

## Declaration

```swift
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

Discussion This method is similar to 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: 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

### Related Documentation

- [init(capacity:)](foundation/nsmutablearray/init(capacity:).md)

### Removing Objects

- [removeAllObjects()](foundation/nsmutablearray/removeallobjects().md)
- [removeLastObject()](foundation/nsmutablearray/removelastobject().md)
- [remove(_:)](foundation/nsmutablearray/remove(_:).md)
- [remove(_:in:)](foundation/nsmutablearray/remove(_:in:).md)
- [removeObject(at:)](foundation/nsmutablearray/removeobject(at:).md)
- [removeObject(identicalTo:)](foundation/nsmutablearray/removeobject(identicalto:).md)
- [removeObject(identicalTo:in:)](foundation/nsmutablearray/removeobject(identicalto:in:).md)
- [removeObjects(fromIndices:numIndices:)](foundation/nsmutablearray/removeobjects(fromindices:numindices:).md)
- [removeObjects(in:)](foundation/nsmutablearray/removeobjects(in:)-4yb26.md)
- [removeObjects(in:)](foundation/nsmutablearray/removeobjects(in:)-1udmn.md)
