I was trying to register a UICollectionReusableView
in my UICollectionView.SupplementaryRegistration
handler in order to apply a content configuration to apply the text
and secondaryText
properties to the reusable view. However, when I try to apply the content configuration on the header
view object that I return in my cell registration handler, I get an error that says: "Value of type 'UICollectionReusableView' has no member 'contentConfiguration'".
How can apply content configuration to a UICollectionReusableView?
This is my code:
let headerRegistration = UICollectionView.SupplementaryRegistration<UICollectionReusableView>(elementKind: UICollectionView.elementKindSectionHeader) { header, elementKind, indexPath in
// Header configuration is handled in the header's init
var configuration = UIListContentConfiguration.plainHeader()
configuration.text = "Current Emotional State"
configuration.secondaryText = "What best describes how you're feeling right now?"
header.contentConfiguration = configuration
}