<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKQueryOperation/queryResultBlock",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:So16CKQueryOperationC8CloudKitE16queryResultBlockys0F0OySo0A6CursorCSgs5Error_pGcSgvp"
  },
  "title" : "queryResultBlock"
}
-->

# queryResultBlock

The closure to execute after CloudKit retrieves all of the records.

```
var queryResultBlock: ((Result<CKQueryOperation.Cursor?, any Error>) -> Void)? { get set }
```

## Discussion

The closure returns no value and takes the following parameter:

- A <doc://com.apple.documentation/documentation/Swift/Result> that contains either:
  - A successful `Result`, or
  - An error that contains information about a problem encountered retrieving the results.

This closure executes only once, and represents your final opportunity to process the results. It executes after all of the individual record match closures. The closure executes serially with respect to the other closures of the operation.

If the number of records that the operation intends to return exceeds [`resultsLimit`](/documentation/CloudKit/CKQueryOperation/resultsLimit), the successful result provides a cursor that you can use to retrieve the next batch of results. You must create a separate operation using the cursor to fetch the next batch of results.

Update the value of this property 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)