<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSRangeSpecifier",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSRangeSpecifier"
  },
  "title" : "NSRangeSpecifier"
}
-->

# NSRangeSpecifier

A specifier for a range of objects in a container.

```
class NSRangeSpecifier
```

## Overview

An `NSRangeSpecifier` object specifies a range (that is, an uninterrupted series) of objects in a container through two delimiting objects. The range is represented by two object specifiers, a start specifier and an end specifier, which can be of any specifier type (such as [`NSIndexSpecifier`](/documentation/Foundation/NSIndexSpecifier) or [`NSWhoseSpecifier`](/documentation/Foundation/NSWhoseSpecifier) object). These specifiers are evaluated in the context of the same container object as the range specifier itself.

You don’t normally subclass `NSRangeSpecifier`.

## Topics

### Initializing a range specifier

[`-  initWithContainerClassDescription:containerSpecifier:key:startSpecifier:endSpecifier:`](/documentation/Foundation/NSRangeSpecifier/init(containerClassDescription:containerSpecifier:key:start:end:))

Returns a range specifier initialized with the given properties.

### Accessing a range specifier

[`endSpecifier`](/documentation/Foundation/NSRangeSpecifier/endSpecifier)

Sets the object specifier representing the last object of the range to a given object.

[`startSpecifier`](/documentation/Foundation/NSRangeSpecifier/startSpecifier)

Returns the object specifier representing the first object of the range.

## Relationships

### Conforms To

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

### Inherits From

[`NSScriptObjectSpecifier`](/documentation/Foundation/NSScriptObjectSpecifier)

---

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)