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

# NSData.SearchOptions

Options for method used to search data objects.

```
struct SearchOptions
```

## Overview

These options are used with the [`range(of:options:in:)`](/documentation/Foundation/NSData/range(of:options:in:)) method.

## Topics

### Initializers

[`init(rawValue:)`](/documentation/Foundation/NSData/SearchOptions/init(rawValue:))

### Constants

[`NSDataSearchBackwards`](/documentation/Foundation/NSData/SearchOptions/backwards)

Search from the end of the data object.

[`NSDataSearchAnchored`](/documentation/Foundation/NSData/SearchOptions/anchored)

Search is limited to start (or end, if searching backwards) of the data object.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

---

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)