<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPSearchTemplateDelegate/searchTemplate(_:selectedResult:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(pl)CPSearchTemplateDelegate(im)searchTemplate:selectedResult:completionHandler:"
  },
  "title" : "searchTemplate(_:selectedResult:completionHandler:)"
}
-->

# searchTemplate(_:selectedResult:completionHandler:)

Tells the delegate that the user selected an item from the search result.

```
func searchTemplate(_ searchTemplate: CPSearchTemplate, selectedResult item: CPListItem, completionHandler: @escaping () -> Void)
```

## Parameters

`searchTemplate`

The current search template.

`item`

The search result item selected by the user.

`completionHandler`

The block that you must call after processing the selected result item.

## 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:
> 
> ```swift
> func searchTemplate(_ searchTemplate: CPSearchTemplate, selectedResult item: CPListItem) async
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

Your implementation must call the completion handler after processing the selected result item.

---

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)