---
title: prepare()
framework: corespotlight
role: symbol
role_heading: Type Method
path: corespotlight/csuserquery/prepare()
---

# prepare()

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

## Declaration

```swift
class func prepare()
```

## Mentioned in

Building a search interface for your app

## Discussion

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.

## See Also

### Preparing to search

- [prepareProtectionClasses(_:)](corespotlight/csuserquery/prepareprotectionclasses(_:).md)
