I'm trying to experiment with replacing my UITableViewCell configuration with the new iOS 14 UIListContentConfiguration and UIBackgroundConfiguration, but I don't see how to perform even the most elementary customizations.
For example, I've got a test cell where, in my data source cellForRowAt:, I was configuring the background like this:
let v = UIImageView(image: UIImage(named:"linen.png"))
v.contentMode = .scaleToFill
cell.backgroundView = v
let v2 = UIView()
v2.backgroundColor = UIColor.blue.withAlphaComponent(0.2)
cell.selectedBackgroundView = v2
The idea is that we have an image as the background of the cell, and when the user taps on the cell to select it, we overlay that with a transparent blue tint. The selectedBackgroundView sits in front of the backgroundView when the cell is selected.
Okay, so how do I do that with UIBackgroundConfiguration? I see how to configure the background view:
var back = UIBackgroundConfiguration.listPlainCell()
let v = UIImageView(image: UIImage(named:"linen.png"))
v.contentMode = .scaleToFill
back.customView = v
cell.backgroundConfiguration = back
But what about what happens when there's a selection? There's no selectedCustomView, and I don't see any provision here for different backgrounds for different states.