CarPlay - transition to now playing template

So I was able to get my list to work, and it changes the station a user is listening to.

However I am wondering how do I get it so that it moves the screen to a now playing screen. As when I go to the CarPlay Dashboard and click now playing I can see it does get the now playing information from my app.

I have included my CarPlaySceneDelegate.swift file so people can see how I got it to work. As there is not a lot of documentation around how to get CarPlay apps to work.


I tried
Code Block
 let nowplayingTemplate = CPNowPlayingTemplate.shared
interfaceController.pushTemplate(nowplayingTemplate, animated: true, completion: true)
            

But that produced an error, wondering how do I get it to transition to the now playing template once a list is clicked/pressed



Your app must set a root template using interfaceController.setRootTemplate() before pushing any other template. So your app could, for example, set a CPListTemplate as the root template, then push the Now Playing template.

As mentioned above, your app must first set a root template before pushing the now playing template. Generally, the now playing template is not appropriate to use as your app's root template.

The now playing template can be presented in one of two ways:

  • Your app can push CPNowPlayingTemplate.shared just like any other template, for example in response to the user tapping on a list item that represents a playable item, like a radio station or song.
  • The system will automatically push that same template, CPNowPlayingTemplate.shared, in response to some system events. Tapping on the Now Playing widget in the CarPlay dashboard is a good example - the system should launch your app and immediately push to now playing.

In both cases, your app should configure CPNowPlayingTemplate.shared- its buttons and any custom configuration - when your app launches in CarPlay, so that you're ready immediately in the event that the system wants to show now playing in your app.

I was doing the same initially i was setting up the Root Template and pushing the Nowplaying template still the Nowplaying text is not showing in the top right corner of the tabs any one could tell be reason and get me out of this ?

CarPlay - transition to now playing template
 
 
Q