---
title: NSMutableIndexSet
framework: foundation
role: symbol
role_heading: Class
path: foundation/nsmutableindexset
---

# NSMutableIndexSet

A mutable collection of unique integer values that represent indexes in another collection.

## Declaration

```swift
class NSMutableIndexSet
```

## Overview

Overview In Swift, this type bridges to IndexSet; use NSMutableIndexSet when you need reference semantics or other Foundation-specific behavior. The NSMutableIndexSet class represents a mutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as a mutable index set. The inclusive range of valid indexes is 0...(NSNotFound - 1); trying to use indexes outside this range is invalid. The values in a mutable index set are always sorted, so the order in which values are added is irrelevant. Do not subclass the NSMutableIndexSet class. important: The Swift overlay to the Foundation framework provides the IndexSet structure, which bridges to the NSMutableIndexSet class and its immutable superclass, NSIndexSet. For more information about value types, see Working with Foundation Types.

## Topics

### Adding Indexes

- [add(_:)](foundation/nsmutableindexset/add(_:)-6dtkj.md)
- [add(_:)](foundation/nsmutableindexset/add(_:)-6zmti.md)
- [add(in:)](foundation/nsmutableindexset/add(in:).md)

### Removing Indexes

- [remove(_:)](foundation/nsmutableindexset/remove(_:)-5li0r.md)
- [remove(_:)](foundation/nsmutableindexset/remove(_:)-196u2.md)
- [removeAllIndexes()](foundation/nsmutableindexset/removeallindexes().md)
- [remove(in:)](foundation/nsmutableindexset/remove(in:).md)

### Shifting Index Groups

- [shiftIndexesStarting(at:by:)](foundation/nsmutableindexset/shiftindexesstarting(at:by:).md)

## Relationships

### Inherits From

- [NSIndexSet](foundation/nsindexset.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSMutableCopying](foundation/nsmutablecopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Sequence](swift/sequence.md)
