A template that displays a destination search screen.
- iOS 12.0+
Use this template to let the user 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.
To use a search template, create an instance of
CPSearch and set its
delegate to an object that conforms to the
CPSearch protocol. Push the template onto the navigation stack by calling
push 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
search, indicating that your app should retrieve the search result. After retrieving the results, call
completion, returning an array of
CPList objects—one list item for each search result item.
When the user selects an item from the search result, the system calls the
search 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 may continue.