---
title: completionHandler
framework: corespotlight
role: symbol
role_heading: Instance Property
path: corespotlight/cssearchquery/completionhandler
---

# completionHandler

The block to execute when the query finishes delivering all results.

## Declaration

```swift
var completionHandler: (((any Error)?) -> Void)? { get set }
```

## Mentioned in

Searching for information in your app

## Discussion

Discussion Specify a value for this property only if you start your query with the start() method. When the query finishes, the query object executes the provided closure once to let you know the search is complete. Use your handler to perform any related cleanup. The block you assign to this property returns no parameters and takes the following parameter: If you start the query by accessing the results property of CSSearchQuery or the responses property of CSUserQuery, the query object doesn’t execute the block in this property.

## See Also

### Executing the query with handler blocks

- [start()](corespotlight/cssearchquery/start().md)
- [cancel()](corespotlight/cssearchquery/cancel().md)
- [isCancelled](corespotlight/cssearchquery/iscancelled.md)
- [foundItemCount](corespotlight/cssearchquery/founditemcount.md)
- [foundItemsHandler](corespotlight/cssearchquery/founditemshandler.md)
