<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSBinarySearchingOptions",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSBinarySearchingOptions"
  },
  "title" : "NSBinarySearchingOptions"
}
-->

# NSBinarySearchingOptions

Options for searches and insertions using [`index(of:inSortedRange:options:usingComparator:)`](/documentation/Foundation/NSArray/index(of:inSortedRange:options:usingComparator:)).

```
struct NSBinarySearchingOptions
```

## Topics

### Constants

[`NSBinarySearchingFirstEqual`](/documentation/Foundation/NSBinarySearchingOptions/firstEqual)

Specifies that the search should return the first object in the range that is equal to the given object.

[`NSBinarySearchingLastEqual`](/documentation/Foundation/NSBinarySearchingOptions/lastEqual)

Specifies that the search should return the last object in the range that is equal to the given object.

[`NSBinarySearchingInsertionIndex`](/documentation/Foundation/NSBinarySearchingOptions/insertionIndex)

Returns the index at which you should insert the object in order to maintain a sorted array.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

---

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)