CarPlaySearchControllerDelegate

@available(iOS 12.0, *)
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

    waypoint

    Waypoint instance, which contains information regarding destination.

    completionHandler

    A block object to be executed when route preview finishes.

  • Method, which is called whenever CPSearchTemplate is presented to give user the opportunity to change CPMapTemplate.mapButtons.

    Declaration

    Swift

    func resetPanButtons(_ mapTemplate: CPMapTemplate)

    Parameters

    mapTemplate

    CPMapTemplate object, on the trailing bottom corner of which an array of bar buttons will be displayed.

  • Method, which is called whenever CPSearchTemplate is presented.

    Declaration

    Swift

    func pushTemplate(_ template: CPTemplate, animated: Bool)

    Parameters

    template

    CPSearchTemplate instance.

    animated

    Boolean flag which determines whether CPSearchTemplate presentation push will be animated or not.

  • Method, which is called whenever user selects CPListItem with destination and CPSearchTemplate is being dismissed.

    Declaration

    Swift

    func popTemplate(animated: Bool)

    Parameters

    animated

    Boolean flag which determines whether CPSearchTemplate dismissal 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 CPListTemplate title 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 completionHandler within this method.

    Declaration

    Swift

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

    Parameters

    searchTemplate

    The search template currently accepting user input.

    searchText

    The updated search text in searchTemplate.

    completionHandler

    Called 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 completionHandler within this method.

    Declaration

    Swift

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

    Parameters

    searchTemplate

    The search template currently accepting user input.

    item

    The search result the user has selected.

    completionHandler

    Called when the delegate is done responding to the selection.

  • Method, which allows to provide list of CPListItems and show them in CPListTemplate after performing search.

    Declaration

    Swift

    func searchResults(with items: [CPListItem], limit: UInt?) -> [CPListItem]

    Parameters

    items

    List of CPListItem, which will be shown in CPListTemplate.

    limit

    Optional integer, which serves as a limiter for a list of search results.

    Return Value

    List of CPListItem objects with certain limit (if applicable).