CarPlaySearchControllerDelegate
public protocol CarPlaySearchControllerDelegate : CPSearchTemplateDelegate
Delegate, which is used to control behavior based on certain actions from the user when performing search on CarPlay.
-
Method, which is called whenever user selects search result.
Declaration
Swift
func previewRoutes(to waypoint: Waypoint, completionHandler: @escaping () -> Void)Parameters
waypointWaypointinstance, which contains information regarding destination.completionHandlerA block object to be executed when route preview finishes.
-
Method, which is called whenever
CPSearchTemplateis presented to give user the opportunity to changeCPMapTemplate.mapButtons.Declaration
Swift
func resetPanButtons(_ mapTemplate: CPMapTemplate)Parameters
mapTemplateCPMapTemplateobject, on the trailing bottom corner of which an array of bar buttons will be displayed. -
Method, which is called whenever
CPSearchTemplateis presented.Declaration
Swift
func pushTemplate(_ template: CPTemplate, animated: Bool)Parameters
templateCPSearchTemplateinstance.animatedBoolean flag which determines whether
CPSearchTemplatepresentation push will be animated or not. -
Method, which is called whenever user selects
CPListItemwith destination andCPSearchTemplateis being dismissed.Declaration
Swift
func popTemplate(animated: Bool)Parameters
animatedBoolean flag which determines whether
CPSearchTemplatedismissal is animated or not.
-
The most recent search results.
Declaration
Swift
var recentSearchItems: [CPListItem]? { get set } -
The most recent search text, which is going to be used as
CPListTemplatetitle after performing search.Declaration
Swift
var recentSearchText: String? { get set } -
Method, which offers the delegate an opportunity to react to updates in the search text.
Postcondition
You must call
completionHandlerwithin this method.Declaration
Swift
func searchTemplate(_ searchTemplate: CPSearchTemplate, updatedSearchText searchText: String, completionHandler: @escaping ([CPListItem]) -> Void)Parameters
searchTemplateThe search template currently accepting user input.
searchTextThe updated search text in
searchTemplate.completionHandlerCalled when the search is complete. Accepts a list of search results.
-
Method, which offers the delegate an opportunity to react to selection of a search result.
Postcondition
You must call
completionHandlerwithin this method.Declaration
Swift
func searchTemplate(_ searchTemplate: CPSearchTemplate, selectedResult item: CPListItem, completionHandler: @escaping () -> Void)Parameters
searchTemplateThe search template currently accepting user input.
itemThe search result the user has selected.
completionHandlerCalled when the delegate is done responding to the selection.
-
Method, which allows to provide list of
CPListItems and show them inCPListTemplateafter performing search.Declaration
Swift
func searchResults(with items: [CPListItem], limit: UInt?) -> [CPListItem]Parameters
itemsList of
CPListItem, which will be shown inCPListTemplate.limitOptional integer, which serves as a limiter for a list of search results.
Return Value
List of
CPListItemobjects with certain limit (if applicable).
Install in Dash
CarPlaySearchControllerDelegate Protocol Reference