Something strange on this forum.
The abstract of your question is:
private func setupCollectionView() { let registration = UICollectionView.CellRegistrationUICollectionViewListCell, Article { cell, _, item in var content = cell.defaultContentConfiguration() content.text = "title"
And the first line
private func setupCollectionView() {
doesn't show in the post itself !
Now back to your question.
I tested your code (which is exactly what is proposed in documentation), and initially I got content type as UIContentConfiguration (which is a protocol) not UIListContentConfiguration (which is a struct with text property).
Could you check the type of content ? Error message seems to show it is UIContentConfiguration
So you could also test
let registration = UICollectionView.CellRegistrationUICollectionViewListCell, Article { cell, _, item in
if var content = cell.defaultContentConfiguration() as? UIListContentConfiguration {
content.text = "title"
cell.contentConfiguration = content
}
}
Note: I tested the following
let registration = UICollectionView.CellRegistrationUICollectionViewListCell, Int { cell, _, item in
var content = cell.defaultContentConfiguration() as? UIContentConfiguration
content.text = "title"
cell.contentConfiguration = content
}
and got the exact same error message as yours :
Value of type 'UIContentConfiguration?' has no member 'text'.
That seems to confirm the problem.