Instance Property

queryCompletionBlock

The block to execute with the search results.

Declaration

var queryCompletionBlock: ((CKQueryOperation.Cursor?, Error?) -> Void)? { get set }

Discussion

The block returns no value and takes the following parameters:

cursor

A CKQueryOperation.Cursor object that indicates there are more results to fetch or nil if the results parameter contains all of the remaining search results. Use the provided object to initialize a new query operation object when you are ready to retrieve the next batch of results.

operationError

An error object containing information about a problem, or nil if the results are retrieved successfully.

This block is executed only once and represents your last chance to process the operation results. It is executed after all of the individual progress blocks but before the operation’s completion block. The block is executed serially with respect to the other progress blocks of the operation. If you intend to use this block to process results, update the value of this property before executing the operation or submitting the operation object to a queue.

When the results of a query operation are known, the operation object uses this block to deliver the available set of records to your app. If the number of records exceeds the value in resultsLimit, the operation object provides an opaque data object in the cursor parameter of your block that you can use to retrieve the next batch of results. You must create a separate operation object using that cursor to get the next batch of results.

See Also

Processing the Operation Results

var recordFetchedBlock: ((CKRecord) -> Void)?

The block to execute for each record returned by the query.