When using NSCollectionLayoutSection.list, how to specific header height and cell item height?

I am using NSCollectionLayoutSection.list as follow.

private func layoutConfig() -> UICollectionViewCompositionalLayout {
    let layout = UICollectionViewCompositionalLayout { section, layoutEnvironment in
        var config = UICollectionLayoutListConfiguration(appearance: .plain)

        config.headerMode = .supplementary
        config.footerMode = .none
        config.showsSeparators = false
        config.headerTopPadding = 0
        
        // https://developer.apple.com/forums/thread/759987
        let layoutSection = NSCollectionLayoutSection.list(using: config, layoutEnvironment: layoutEnvironment)
        layoutSection.interGroupSpacing = 0
        layoutSection.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
        
        if let header = layoutSection.boundarySupplementaryItems.first(where: { $0.elementKind == UICollectionView.elementKindSectionHeader }) {
            header.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
        }
        
        return layoutSection
    }
    
    return layout
}

We provide our own custom header view and cell item view.

Header View

class HideShowHeader: UICollectionViewListCell {
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override func systemLayoutSizeFitting(_ targetSize: CGSize) -> CGSize {
        // Ensure the cell fills the width of the collection view
        let size = CGSize(
            width: targetSize.width,
            height: 80
        )
        
        print(">>>> size \(size)")
        
        return size
    }
}

Cell Item View

class TodoCell: UICollectionViewListCell {

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func systemLayoutSizeFitting(_ targetSize: CGSize) -> CGSize {
        // Ensure the cell fills the width of the collection view
        let size = CGSize(
            width: targetSize.width,
            height: 80
        )
        
        return size
    }
}

We would like to fine-tune the height of header and cell item.

However, override systemLayoutSizeFitting doesn't work.

May I know, when using NSCollectionLayoutSection.list, how to specific header height and cell item height?

Thanks.

When using NSCollectionLayoutSection.list, how to specific header height and cell item height?
 
 
Q