According to Apple's Documentation one should show an Activity Indicator to indicate something is loading or taking time to show on screen. This is reasonable, and I'd love to do just that...
I feel like I'm missing something obvious, but I cannot figure out how to show an activity indicator in a template of a CarPlay app as I don't have access to the view. I can only interact with the templates available.
If I were trying to match the image from Apple's docs, I'd assume I would need to use the listTemplate
and some how add the activity indicator to that.
Has anyone else come across this? Any help would be appreciated!
Update from an Apple Engineer during WWDC (7/2021)
I asked this question during WWDC21 and got the following response.
If you are using CPListTemplate
, the system will invoke your -[CPListItem handler]
when the user taps the list item. The system provides a completion block to your handler, which you should be sure to invoke after your app finishes processing the user's selection. If your app does not immediately call the completion block, that's okay! Maybe your app needs to perform a network request that takes some time. The system will automatically add a spinner to your list item after a short delay if the completion block has not yet been called.
Another option could be to present a list template with a single list item that indicates the rest of the items are still loading/in-progress.
For the tab bar template in particular, you can update the tabs displayed after it's already been presented. For example, you could dynamically add one or more tabs if they absolutely cannot be presented immediately upon app launch.
Or, for a full-screen presentation, you could present a CPAlertTemplate
to indicate an error or loading state in your app.