I'm watching and rewatching WWDC 2020 "Modern cell configuration" but enlightening does not strike.
I understand that the built-in ListContentConfiguration has properties similar to the built-in cell style components like the text label and the image view. But I never use the built-in cell styles; I always create a cell subclass and design the cell subviews from scratch in a xib or storyboard prototype cell, or even structure them in code.
So how do I use Apple's configurations to populate my cell's subviews?
The video says:
In addition to the list content configuration we're also giving you access to the associated list content view which implements all of the rendering. You just create or update this view using the configuration, and then you can add it as a subview right alongside your own custom views. This lets you take advantage of all the content configuration features and combine the ListContentView with your own additional custom views next to it, such as an extra image view or a label.
OK, no, that's not what I want to do. I don't want any of the built-in cell style subviews.
So then the video says:
Even when you're building a completely custom view hierarchy inside your cells, you can still use the system configurations to help. Because configurations are so lightweight, you can use them as a source of default values for things like fonts, colors, and margins that you copy over to your custom views, even if you never apply the configuration directly itself. And for more advanced use cases you can create a completely custom content configuration type with a paired content view class that renders it, and then use your custom configuration with any cell the same way that you would use a list content configuration.
My italics, and the italics are part I'm asking about. I'm asking: how?
I understand that there is a UIContentConfiguration protocol.
I understand that the conforming class generates through its
makeContentView
method a "content view", a UIView with aconfiguration
property (because it conforms to UIContentConfiguration).
So how do I use that in conjunction with my custom cell subclass, to communicate information from the data source to the cell and populate the cell's subviews?
As usual, it feels like Apple shows us the toy examples and completely omits details about how this can work in the real world. Has anyone figured this out?