---
title: CSImportExtension
framework: corespotlight
role: symbol
role_heading: Class
path: corespotlight/csimportextension
---

# CSImportExtension

An object that provides searchable attributes for file types that the app supports.

## Declaration

```swift
class CSImportExtension
```

## Overview

Overview To create a Spotlight File Import extension, add a target to your app using the Spotlight File Import extension template in Xcode. The template project contains a subclass of CSImportExtension. To index content on a user’s device, Core Spotlight loads your extension and invokes the update(_:forFileAt:) method. Core Spotlight passes a CSSearchableItemAttributeSet and URL of a file to the extension, and you set properties that are relevant for the file. important: Spotlight File Import extensions don’t provide functionality in macOS. To make custom files available to Spotlight in macOS, create a Spotlight importer plugin. For more information, refer to Spotlight Importer Programming Guide. Typically, your extension loads details about the file and uses that information to set properties of the attribute set. For example, if your app contains files that are notes the user creates, it does the following: class NoteImporter: CSImportExtension {     override func update(_ attributes: CSSearchableItemAttributeSet, forFileAt contentURL: URL) throws {         // NoteDetails is an app-defined object that encapsulates a note.         guard let note = NoteDetails.noteDetails(for: contentURL) else {             throw NoteError.noteNotFound         }         attributes.title = note.title         attributes.contentCreationDate = note.creationDate         attributes.userCreated = NSNumber(booleanLiteral: true)     } } important: Core Spotlight indexes files in batches and may call update(_:forFileAt:) simultaneously on multiple queues with different values of contentURL. To specify the file types your app supports, set the value of CSSupportedContentTypes in your extension’s Info.plist file to an array of file type identifiers. For more information about file type identifiers, see Uniform Type Identifiers. The app in the previous example configures the extension’s Info.plist as follows: <key>NSExtension</key> <dict>     <key>NSExtensionPointIdentifier</key>     <string>com.apple.spotlight.import</string>     <key>NSExtensionPrincipalClass</key>     <string>FileImporter</string>     <key>NSExtensionAttributes</key>     <dict>         <key>CSSupportedContentTypes</key>         <array>             <string>com.example.mynoteapp.note</string>         </array>     </dict> </dict>

## Topics

### Providing searchable attributes

- [update(_:forFileAt:)](corespotlight/csimportextension/update(_:forfileat:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSExtensionRequestHandling](foundation/nsextensionrequesthandling.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Spotlight app extensions

- [Regenerating your app’s indexes on demand](corespotlight/regenerating-your-app-s-indexes-on-demand.md)
- [CSIndexExtensionRequestHandler](corespotlight/csindexextensionrequesthandler.md)
