Skip to content
Merged
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions MagazineLayout/Public/MagazineLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,19 @@ public final class MagazineLayout: UICollectionViewLayout {
return
}

// If our layout direction is `bottomToTop`, allow changes to the bottom content inset to
// automatically adjust the content offset. `UICollectionView` behaves this way by default when
// the top content inset changes, so this adds the same behavior to the bottom.
let bottomContentInset = contentInset.bottom
if
case .bottomToTop = verticalLayoutDirection,
let previousBottomContentInset,
previousBottomContentInset != bottomContentInset
{
context.contentOffsetAdjustment.y = bottomContentInset - previousBottomContentInset
}
previousBottomContentInset = bottomContentInset

let shouldInvalidateLayoutMetrics = !context.invalidateEverything &&
!context.invalidateDataSourceCounts

Expand Down Expand Up @@ -899,6 +912,7 @@ public final class MagazineLayout: UICollectionViewLayout {
private var isPerformingAnimatedBoundsChange = false
private var targetContentOffsetAnchor: TargetContentOffsetAnchor?
private var stagedContentOffsetAdjustment: CGPoint?
private var previousBottomContentInset: CGFloat?

// Used to provide the model state with the current visible bounds for the sole purpose of
// supporting pinned headers and footers.
Expand Down