<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPSearchTemplate",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(cs)CPSearchTemplate"
  },
  "title" : "CPSearchTemplate"
}
-->

# CPSearchTemplate

A template that provides the ability to search for a destination and see a list of search results.

```
@MainActor class CPSearchTemplate
```

## Overview

Use this template to provide the ability to search for a destination. When CarPlay displays the template, the user sees a search field, a Cancel button, and a localized keyboard. The template also shows the list of search results after your app completes the search request.

> Note:
> Some vehicles may limit the display of the keyboard. Check the ``doc://com.apple.carplay/documentation/CarPlay/CPSessionConfiguration/limitedUserInterfaces`` property to determine whether there are limits.

To use a search template, create an instance of [`CPSearchTemplate`](/documentation/CarPlay/CPSearchTemplate) and set its [`delegate`](/documentation/CarPlay/CPSearchTemplate/delegate) to an object that conforms to the [`CPSearchTemplateDelegate`](/documentation/CarPlay/CPSearchTemplateDelegate) protocol. Push the template onto the navigation hierarchy by calling [`pushTemplate(_:animated:completion:)`](/documentation/CarPlay/CPInterfaceController/pushTemplate(_:animated:completion:)) on the interface controller. This presents the search template to the user.

As the user enters text into the search field, the system calls the delegate method [`searchTemplate(_:updatedSearchText:completionHandler:)`](/documentation/CarPlay/CPSearchTemplateDelegate/searchTemplate(_:updatedSearchText:completionHandler:)), indicating that your app should retrieve the search result. After retrieving the results, call `completionHandler` to return an array of [`CPListItem`](/documentation/CarPlay/CPListItem) objects—one list item for each search result item.

When the user selects an item from the search result, the system calls the [`searchTemplate(_:selectedResult:completionHandler:)`](/documentation/CarPlay/CPSearchTemplateDelegate/searchTemplate(_:selectedResult:completionHandler:)) method on the delegate object. The delegate performs any necessary operations to process the selected item, then calls the completion handler to let the system know it can continue.

## Topics

### Providing a Search Template Delegate

[`delegate`](/documentation/CarPlay/CPSearchTemplate/delegate)

The object that serves as the search template’s delegate.

[`CPSearchTemplateDelegate`](/documentation/CarPlay/CPSearchTemplateDelegate)

The interface for an object that serves as the search template’s delegate.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Sendable`](/documentation/Swift/Sendable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`CPTemplate`](/documentation/CarPlay/CPTemplate)

---

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)