<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSSearchQuery/foundItemsHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:objc(cs)CSSearchQuery(py)foundItemsHandler"
  },
  "title" : "foundItemsHandler"
}
-->

# foundItemsHandler

The block to execute when the query delivers a new batch of matching items.

```
var foundItemsHandler: (([CSSearchableItem]) -> Void)? { get set }
```

## Discussion

Assign a block to this property that has no return value and
takes the following parameter:

- items: An array of items that match the specified query.

Specify a value for this property only if you start your query
with the [`start()`](/documentation/CoreSpotlight/CSSearchQuery/start()) method. While the query runs, the query object
executes the provided closure one or more times to deliver suggested
search results for the current search term. Use your handler to
retrieve the those results and display them. The query object
stops delivering matching items when it reaches the maximum number
found in the [`maxResultCount`](/documentation/CoreSpotlight/CSUserQueryContext/maxResultCount) property of
the query configuration parameters.

Each time the query object calls your handler, it delivers only
the new items that it found since the last time it called your
handler. However, the query object updates the value of the
[`foundItemCount`](/documentation/CoreSpotlight/CSSearchQuery/foundItemCount) property with the total number of items before
it calls your handler.

If you start the query by accessing the [`results`](/documentation/CoreSpotlight/CSSearchQuery/results-swift.property)
property of [`CSSearchQuery`](/documentation/CoreSpotlight/CSSearchQuery) or the [`responses`](/documentation/CoreSpotlight/CSUserQuery/responses-swift.property) property
of [`CSUserQuery`](/documentation/CoreSpotlight/CSUserQuery), the query object doesn’t execute the block in
this property. property of [`CSUserQuery`](/documentation/CoreSpotlight/CSUserQuery), the query object
doesn’t execute the block in this property.

---

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)