<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSUserQuery/cancel()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:objc(cs)CSUserQuery(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 queries started using either the [`start()`](/documentation/CoreSpotlight/CSUserQuery/start())
method or by accessing the [`responses`](/documentation/CoreSpotlight/CSUserQuery/responses-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)