<!--
{
  "availability" : [
    "macOS: 10.10.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "NotificationCenter",
  "identifier" : "/documentation/NotificationCenter/NCWidgetSearchViewDelegate/widgetSearch(_:searchForTerm:maxResults:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Notification Center"
    ],
    "preciseIdentifier" : "c:objc(pl)NCWidgetSearchViewDelegate(im)widgetSearch:searchForTerm:maxResults:"
  },
  "title" : "widgetSearch(_:searchForTerm:maxResults:)"
}
-->

# widgetSearch(_:searchForTerm:maxResults:)

Asks the delegate to search using the specified term.

```
func widgetSearch(_ controller: NCWidgetSearchViewController, searchForTerm searchTerm: String, maxResults max: Int)
```

## Parameters

`controller`

The widget’s search view controller.

`searchTerm`

The term a user entered into the search field.

`max`

The maximum number of results the search view controller can display.

## Discussion

The search view controller calls this method as soon as a user begins to type. If there is a maximum number of results the search view controller can display, it specifies this number in `max`. The delegate can use `max` to decide how many search results to return.

The delegate sets the search view controller’s [`searchResults`](/documentation/NotificationCenter/NCWidgetSearchViewController/searchResults) property to the array of search result objects.

---

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)