An object representing an immutable collection of unique integer values that bridges to
NSIndex when you need reference semantics or other Foundation-specific behavior.
- iOS 2.0+
- macOS 10.3+
- tvOS 9.0+
- watchOS 2.0+
NSIndex 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 .. NSNot.
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