<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSSearchQuery/protectionClasses",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:objc(cs)CSSearchQuery(py)protectionClasses"
  },
  "title" : "protectionClasses"
}
-->

# protectionClasses

The protection types of the indexes you want to search.

```
var protectionClasses: [FileProtectionType] { get set }
```

## Discussion

When creating an index to store your app’s data, you can associate a
file protection type with that index to encrypt the data it contains.
File protections prevent access to the data unless specific conditions
occur. For example, you can make the data available only when the device
is unlocked, or make it available after the first successful unlocking
of the device. This property indicates which of your app’s protected
indexes you want to search.

Possible values for this property are
<doc://com.apple.documentation/documentation/Foundation/FileProtectionType/complete>,
<doc://com.apple.documentation/documentation/Foundation/FileProtectionType/completeUnlessOpen>,
and <doc://com.apple.documentation/documentation/Foundation/FileProtectionType/completeUntilFirstUserAuthentication>.
By default, the system retrives the data protection class from the
<doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.developer.default-data-protection>
entitlement, if it exists; otherwise, the default value is
<doc://com.apple.documentation/documentation/Foundation/FileProtectionType/completeUntilFirstUserAuthentication>.

For more information on how to configure file protection types with
an index, see [Adding your app’s content to Spotlight indexes](/documentation/CoreSpotlight/adding-your-app-s-content-to-spotlight-indexes).

---

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)