0

In my CarPlay App I want to show a list of parking garages and its usage. Currently I am doing this by showing the name in the title and the usage in the detailsText. BUT what I want to have is a Name and a ProgressBar to visualize the usage.

Thanks for your help!

This my Code:

        var items: [ParkingGarage] = []
        do {
            items = try getData()
        } catch {
            print(error)
        }
        var sections: [CPListSection] = []
        let listItems = items.map { item in
            let cell = CPListItem(text: item.name, detailText: "Free: \(item.freePlaces)/\(item.allPlaces)", image: UIImage(systemName: "parkingsign.circle")?.withTintColor(.systemPink), accessoryImage: .none, accessoryType: .none)
            cell.handler = { cell, completion in
                        completion()
                    }
            return cell
        }
        let section = CPListSection(items: listItems)
        sections.append(section)
        
        // Create a `CPListTemplate` with the sections
        let listTemplate = CPListTemplate(title: "ParkenUlm", sections: sections)
        interfaceController?.setRootTemplate(listTemplate, animated: true)
Nicolas
  • 76
  • 4

0 Answers0