I am currently developing a CarPlay application using CPPointOfInterestTemplate. I am displaying a list of restaurants on a map, and when a user taps on a restaurant in the list, I present a detail view using CPPointOfInterest. The list of restaurants is updated based on the user's location changes using the setPointsOfInterest method.
-
Is there a way to detect when they press the close button (typically an "X" button) to dismiss the detail view and return to the list?
-
Is there a delegate method or any other mechanism to determine whether the CPPointOfInterestTemplate is currently displaying the list of points of interest or the detail view of a specific point of interest? I need to know this so that I can avoid updating the list based on location changes when the detail view is being shown.
My current implementation updates the list of restaurants whenever the user's location changes. This works well when the user is Browse the list. However, if the user has navigated to the detail view of a restaurant, a location update currently causes the list to reload, which results in the detail view being dismissed and the user being taken back to the list. I would like to prevent this from happening and only update the list when the list view is visible.
Hi,
You can use func pointOfInterestTemplate(_ pointOfInterestTemplate: CPPointOfInterestTemplate, didSelectPointOfInterest pointOfInterest: CPPointOfInterest)
of CPPointOfInterestTemplateDelegate
to know if an item was selected. There isn't a good API for de-selection or dismissal.
If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here. If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?