Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion IVCollectionKit/Source/CollectionSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ open class CollectionSection : AbstractCollectionSection {
}

open func sizeForItem(at indexPath: IndexPath, boundingSize: CGSize) -> CGSize {
return items[indexPath.item].estimatedSize(boundingSize: boundingSize)
let sizeWithInsets = CGSize(width: boundingSize.width - insetForSection.left - insetForSection.right,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't totally agree with this change. For instance, we might not wanna use vertical insets for CollectionView with vertical scrolling. For some cases we need to know exact size of collection view and only use horizontal / vertical section insets for proportions calculation. I made change in 1.0.0 branch where we can respect section insets and spacings in cell size calculation. If u wanna match ur cell width to collectionView width and section insets u should consider use adjustsWidth(true) modifier of CollectionItem

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height: boundingSize.height - insetForSection.top - insetForSection.bottom)
return items[indexPath.item].estimatedSize(boundingSize: sizeWithInsets)
}

open func itemAdjustsWidth(at index: Int) -> Bool {
Expand Down