NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as an index set. Indexes must be in the range
0 .. NSNotFound - 1.
- iOS 2.0+
- macOS 10.3+
- tvOS 9.0+
- watchOS 2.0+
You use index sets in your code to store indexes into some other data structure. For example, given an
NSArray object, you could use an index set to identify a subset of objects in that array.
You should not use index sets to store an arbitrary collection of integer values because index sets store indexes as sorted ranges. This makes them more efficient than storing a collection of individual integers. It also means that each index value can only appear once in the index set.
You must not subclass the
The mutable subclass of