<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSSearchQuery/cancel()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:objc(cs)CSSearchQuery(im)cancel"
  },
  "title" : "cancel()"
}
-->

# cancel()

Cancels the current query operation.

```
func cancel()
```

## 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()`](/documentation/CoreSpotlight/CSSearchQuery/start()) method or by accessing the [`results`](/documentation/CoreSpotlight/CSSearchQuery/results-swift.property) 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.

---

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)