Skip to content

Commit

Permalink
Update AlignedCollectionViewFlowLayout.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
VladMelnik authored Dec 30, 2021
1 parent 49330ef commit 369d5fe
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,12 @@ open class AlignedCollectionViewFlowLayout: UICollectionViewFlowLayout {
var lineFrame = layoutAttributes.frame
lineFrame.origin.x = sectionInset.left
lineFrame.size.width = lineWidth
return super.layoutAttributesForElements(in: lineFrame) ?? []
let result = super.layoutAttributesForElements(in: lineFrame)
if let result = result, !result.isEmpty {
return result
} else {
return [UICollectionViewLayoutAttributes()]
}
}

/// Copmutes the alignment axis with which to align the items represented by the `layoutAttributes` objects vertically.
Expand Down

0 comments on commit 369d5fe

Please sign in to comment.