Contents

CPNowPlayingTemplate

A shared system template that displays Now Playing information.

Declaration

@MainActor class CPNowPlayingTemplate

Overview

The Now Playing template displays information from MPNowPlayingInfoCenter and MPNowPlayingSession. Instead of instantiating your own Now Playing template, CarPlay provides a shared instance that you configure. The template displays a series of playback control buttons, as well as information about the current album and artist, and what’s coming up next.

When enabling your Now Playing template’s Album-Artist and Up Next buttons, you must create an object that implements the CPNowPlayingTemplateObserver protocol and register it as an observer by calling the template’s add(_:) method.

To display the Now Playing template, call your interface controller’s pushTemplate(_:animated:completion:) method to push it onto your navigation hierarchy. You can’t display the Now Playing template modally.

When CarPlay presents Now Playing information for your app, it uses the shared instance of this template.

Topics

Managing the Shared Template

Managing the Template’s Buttons

Managing Albums, Artists, and Up Next

Observing Now Playing Events

Instance Properties

See Also

Audio