<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSSearchableIndex/init(name:protectionClass:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:objc(cs)CSSearchableIndex(im)initWithName:protectionClass:"
  },
  "title" : "init(name:protectionClass:)"
}
-->

# init(name:protectionClass:)

Returns an on-device index with the specified name and data protection class.

```
init(name: String, protectionClass: FileProtectionType?)
```

## Parameters

`name`

A name that pertains to your custom organization.

`protectionClass`

The file protection class. Acceptable values are <doc://com.apple.documentation/documentation/Foundation/FileProtectionType/none>, <doc://com.apple.documentation/documentation/Foundation/FileProtectionType/complete>, <doc://com.apple.documentation/documentation/Foundation/FileProtectionType/completeUnlessOpen>, or <doc://com.apple.documentation/documentation/Foundation/FileProtectionType/completeUntilFirstUserAuthentication>.

## Return Value

An index that can handle items within the specified protection class.

## Discussion

Use this method to specify a protection class for an index. You can specify a default protection class for index items in the entitlements for your app.

---

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)