private func createLayout(isShowingHeaderView: Bool) -> UICollectionViewLayout {
let sectionProvider = { (sectionIndex: Int, layoutEnvironment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection? in
var config = UICollectionLayoutListConfiguration(appearance: .plain)
config.showsSeparators = false
config.headerMode = .supplementary
let section = NSCollectionLayoutSection.list(
using: config,
layoutEnvironment: layoutEnvironment
)
let headerSize = NSCollectionLayoutSize(
widthDimension: .fractionalWidth(1.0),
heightDimension: .absolute(isShowingHeaderView ? 78: 10))
let header = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: headerSize,
elementKind: UICollectionView.elementKindSectionHeader,
alignment: .top)
section.boundarySupplementaryItems = [header]
config.headerTopPadding = 0
return section
}
let config = UICollectionViewCompositionalLayoutConfiguration()
return UICollectionViewCompositionalLayout(sectionProvider: sectionProvider, configuration: config)
}
여기서
config.headerMode = .supplementary
이게 문제였다
이걸 .none으로 바꿔주니 여백이 사라졌다
여백은 보니까 한 22정도 였음
config.headerMode = .none
정말 큰 도움이 됐어요 감사합니다 !!