---
title: cancel()
framework: corespotlight
role: symbol
role_heading: Instance Method
path: corespotlight/cssearchquery/cancel()
---

# cancel()

Cancels the current query operation.

## Declaration

```swift
func cancel()
```

## Mentioned in

Searching for information in your app

## Discussion

Discussion Cancel a query operation when you no longer need the results. You can use this method to cancel a query you started, by using either the start() method or by accessing the results property. After you cancel a query operation, you can’t restart it. To perform a new query, create a new query object. For example, you might cancel one query and start a new one when the text in your app’s search control changes.

## See Also

### Executing the query with handler blocks

- [start()](corespotlight/cssearchquery/start().md)
- [isCancelled](corespotlight/cssearchquery/iscancelled.md)
- [foundItemCount](corespotlight/cssearchquery/founditemcount.md)
- [foundItemsHandler](corespotlight/cssearchquery/founditemshandler.md)
- [completionHandler](corespotlight/cssearchquery/completionhandler.md)
