<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSCoreDataCoreSpotlightDelegate/deleteSpotlightIndex(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCoreDataCoreSpotlightDelegate(im)deleteSpotlightIndexWithCompletionHandler:"
  },
  "title" : "deleteSpotlightIndex(completionHandler:)"
}
-->

# deleteSpotlightIndex(completionHandler:)

Deletes all searchable items from the configured index.

```
func deleteSpotlightIndex(completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

## Discussion

The closure returns no value and takes only a single parameter, which is an error object that contains information about issues preventing the deletion of searchable items, or `nil` if Core Spotlight successfully deletes all searchable items.

Depending on the cause of the issue, an error can originate from Core Data or from Core Spotlight. Make sure your app can handle both scenarios.

> Note:
> You must call ``doc://com.apple.coredata/documentation/CoreData/NSCoreDataCoreSpotlightDelegate/stopSpotlightIndexing()`` before you call this method; otherwise, Core Data immediately recreates the index.

---

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)