---
title: "searchTemplate(_:updatedSearchText:completionHandler:)"
framework: carplay
role: symbol
role_heading: Instance Method
path: "carplay/cpsearchtemplatedelegate/searchtemplate(_:updatedsearchtext:completionhandler:)"
---

# searchTemplate(_:updatedSearchText:completionHandler:)

Tells the delegate that the user updated the search criteria text.

## Declaration

```swift
func searchTemplate(_ searchTemplate: CPSearchTemplate, updatedSearchText searchText: String, completionHandler: @escaping ([CPListItem]) -> Void)
```

```swift
func searchTemplate(_ searchTemplate: CPSearchTemplate, updatedSearchText searchText: String) async -> [CPListItem]
```

## Parameters

- `searchTemplate`: The current search template.
- `searchText`: The search criteria text entered by the user.
- `completionHandler`: The block your implementation calls after retrieving the search result.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func searchTemplate(_ searchTemplate: CPSearchTemplate, updatedSearchText searchText: String) async -> [CPListItem] For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. After the method retrieves the search result, the method must call completionHandler for the system to display the result to the user.
