<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSUserQuery/prepare()",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:objc(cs)CSUserQuery(cm)prepare"
  },
  "title" : "prepare()"
}
-->

# prepare()

Performs one-time tasks that prepare Spotlight to search for
content in all search indexes.

```
class func prepare()
```

## Discussion

Call this method once during your app’s lifecycle to give Spotlight
time to load the resources it needs for search. This preparation comes
at a cost, so measure your app’s performance and determine an appropriate
time to call it. For example, you might call it when you load an
interface that includes search features.

You don’t need to call this method more than once during the lifetime
of your app, but it’s safe to call the method multiple times.

---

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)