Search code examples
iosswiftlistcarplay

CarPlay using CPListTemplate


I am new to Carplay development and this is my first app. Could someone explain on how to display three rows within a list item?

Currently I have the belowenter image description here

I want to achieve the below,

enter image description here

I want one extra row or a line of text to be added. I tried using \n, it didn't work. How to achieve this?

I tried using line breaks, I checked of the Info template. But the styling goes for a toss if I use that. So I need to make changes only in the list


Solution

  • CarPlay templates and UI components are much more limited than UIKit or SwiftUI components.

    A CPListItem only supports two lines of text.

    It looks like you are trying to create a list of EV charging stations, in which case you probably want to use a CPPointOfInterestTemplate. this displays a map to which you can add CPPointOfInterest instances. The points of interest are shown as pins on the map as well as in a picker view that looks like the second image in your question.

    A CPPointOfInterest has a title, subtitle and summary. These three items are shown in the picker overlay on the map. The picker item leads to a detail view, which can show a detailTitle, a detailSubtitle and a detailSummary.