---
title: query
framework: cloudkit
role: symbol
role_heading: Instance Property
path: cloudkit/ckqueryoperation/query
---

# query

The query for the search.

## Declaration

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

## Discussion

Discussion The initial value of this property is the query that you provide to the init(query:) method. When the value in the cursor 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 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.

## See Also

### Configuring the Query Operation

- [cursor](cloudkit/ckqueryoperation/cursor-swift.property.md)
- [CKQueryOperation.Cursor](cloudkit/ckqueryoperation/cursor-swift.class.md)
- [zoneID](cloudkit/ckqueryoperation/zoneid.md)
- [resultsLimit](cloudkit/ckqueryoperation/resultslimit.md)
- [maximumResults](cloudkit/ckqueryoperation/maximumresults.md)
- [desiredKeys](cloudkit/ckqueryoperation/desiredkeys-7qrse.md)
