---
title: "init(name:protectionClass:)"
framework: corespotlight
role: symbol
role_heading: Initializer
path: "corespotlight/cssearchableindex/init(name:protectionclass:)"
---

# init(name:protectionClass:)

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

## Declaration

```swift
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.

## Mentioned in

Adding your app’s content to Spotlight indexes

## Return Value

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

## Discussion

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.

## See Also

### Creating an index

- [default()](corespotlight/cssearchableindex/default().md)
- [init(name:)](corespotlight/cssearchableindex/init(name:).md)
