<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKQueryOperation/query",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKQueryOperation(py)query"
  },
  "title" : "query"
}
-->

# query

The query for the search.

```
@NSCopying var query: CKQuery? { get set }
```

## Discussion

The initial value of this property is the query that you provide to the [`init(query:)`](/documentation/CloudKit/CKQueryOperation/init(query:)) method. When the value in the [`cursor`](/documentation/CloudKit/CKQueryOperation/cursor-swift.property) property is `nil`, the operation uses this property’s value to execute a new search and return its results to your completion handler. If [`cursor`](/documentation/CloudKit/CKQueryOperation/cursor-swift.property) isn’t `nil`, the operation uses the cursor instead.

If you intend to specify or change the value of this property, do so before you execute the operation or submit it to a queue.

---

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)