When installing MapboxNavigation using CocoaPods, any functionality guarded by canImport(MapboxGeocoder) is unavailable, namely RecentItem and CarPlaySearchController’s conformance to the CPSearchTemplateDelegate protocol: https://github.com/mapbox/mapbox-navigation-ios/issues/1839#issuecomment-438789900. Developers using CocoaPods are forced to copy the entirety of CarPlaySearchController+ CPSearchTemplateDelegate.swift and RecentItem.swift into their applications, plus the carplay_search asset, in order to implement a search interface powered by MapboxGeocoder.swift in CarPlay.
Until the underlying issue with CocoaPods is resolved or worked around, we can streamline the steps to implement that MapboxGeocoder.swift-powered interface. CarPlaySearchControllerDelegate should be more granular, with hooks for kicking off a geocoding request and receiving the response. Most of the implementation can remain in the navigation SDK, but it should rely on types vended by required libraries, so any GeocodedPlacemark usage should be replaced by Waypoint or perhaps an MGLPointAnnotation subclass akin to MapKit’s MKMapItem class.
The developer would need to write some minimal code to configure the search and convert its responses into waypoints, but these are exactly the hooks a developer would want for customization purposes anyways. We would need to document appropriate default options to avoid surprises like a missing focalLocation or a missing locale. In the future, once we implement a preview view controller (#808), it may make sense to formally depend on MapboxGeocoder.swift and vend those defaults at that time.
When installing MapboxNavigation using CocoaPods, any functionality guarded by
canImport(MapboxGeocoder)
is unavailable, namelyRecentItem
and CarPlaySearchController’s conformance to the CPSearchTemplateDelegate protocol: https://github.com/mapbox/mapbox-navigation-ios/issues/1839#issuecomment-438789900. Developers using CocoaPods are forced to copy the entirety of CarPlaySearchController+ CPSearchTemplateDelegate.swift and RecentItem.swift into their applications, plus thecarplay_search
asset, in order to implement a search interface powered by MapboxGeocoder.swift in CarPlay.Until the underlying issue with CocoaPods is resolved or worked around, we can streamline the steps to implement that MapboxGeocoder.swift-powered interface. CarPlaySearchControllerDelegate should be more granular, with hooks for kicking off a geocoding request and receiving the response. Most of the implementation can remain in the navigation SDK, but it should rely on types vended by required libraries, so any GeocodedPlacemark usage should be replaced by Waypoint or perhaps an MGLPointAnnotation subclass akin to MapKit’s MKMapItem class.
The developer would need to write some minimal code to configure the search and convert its responses into waypoints, but these are exactly the hooks a developer would want for customization purposes anyways. We would need to document appropriate default options to avoid surprises like a missing
focalLocation
or a missinglocale
. In the future, once we implement a preview view controller (#808), it may make sense to formally depend on MapboxGeocoder.swift and vend those defaults at that time./cc @mapbox/navigation-ios @mapbox/search-sdk