How to reduce cell height (vertical margins) when using UIListContentConfiguration

The default cell height is 44pt in iOS 18 and 52pt in iOS 26. I'm trying to reduce the height back to 44pt in one screen that needs to fit as much content on screen as possible. How do you do that when using UIListContentConfiguration?

I expected this would do the trick but alas it doesn't reduce the cell height.

let cellRegistration = UICollectionView.CellRegistration<UICollectionViewListCell, Item> { cell, indexPath, item in
    cell.contentConfiguration = {
        var config = UIListContentConfiguration.valueCell()
        config.text = "Title"
        config.secondaryText = "Value"

        // This only removes horizontal margins, does not change vertical margins
        config.axesPreservingSuperviewLayoutMargins = []
        config.directionalLayoutMargins = .zero
        return config
    }()
}

Have you tried using a UICollectionViewCompositionalLayout with a height demonsiton for your itemSize? Please review Implementing modern collection views article and sample code. It has various examples that should help resolve your issue.

Thanks, I should note I want to reduce the vertical margins in the cell as opposed to setting an absolute fixed height dimension, in order to properly support dynamic type text sizes. This is the compositional layout I'm using:

let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in
    let config = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
    return NSCollectionLayoutSection.list(using: config, layoutEnvironment: environment)
}

If you wanted to reduce the vertical margins, you’d need to set the top/bottom values of the directionalLayoutMargins

Setting directionalLayoutMargins top/bottom to a number less than 15 (the default value) has no effect (even negative numbers). A number greater than 15 does increase it beyond the default margins. Seems the system enforces minimum vertical margins :/

How to reduce cell height (vertical margins) when using UIListContentConfiguration
 
 
Q