From a8275e08e1857b3e232116b974118dbae30fbdff Mon Sep 17 00:00:00 2001 From: Maxime Ollivier Date: Tue, 16 Jan 2018 07:35:21 -0800 Subject: [PATCH] clarify assert message Summary: * Clarify assert message by adding item width/height * Before: Width of item 1 in section 2 must be less than container 375 accounting for section insets {0, 0, 0, 0} * After: Width of item 1 in section 2 (415 pt) must be less than or equal to container (375 pt) accounting for section insets {0, 0, 0, 0} Reviewed By: rnystrom Differential Revision: D6711829 fbshipit-source-id: be99e83fd68cd345cb6a05acdde27c8252e59650 --- Source/IGListCollectionViewLayout.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/IGListCollectionViewLayout.mm b/Source/IGListCollectionViewLayout.mm index ebb50643..cf4f3523 100644 --- a/Source/IGListCollectionViewLayout.mm +++ b/Source/IGListCollectionViewLayout.mm @@ -492,11 +492,14 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut const CGSize size = [delegate collectionView:collectionView layout:self sizeForItemAtIndexPath:indexPath]; IGAssert(CGSizeGetLengthInDirection(size, fixedDirection) <= paddedLengthInFixedDirection - || fabs(CGSizeGetLengthInDirection(size, fixedDirection) - paddedLengthInFixedDirection) < FLT_EPSILON, - @"%@ of item %zi in section %zi must be less than container %.0f accounting for section insets %@", - self.scrollDirection == UICollectionViewScrollDirectionVertical ? @"Width" : @"Height", - item, section, CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection), - NSStringFromUIEdgeInsets(insets)); + || fabs(CGSizeGetLengthInDirection(size, fixedDirection) - paddedLengthInFixedDirection) < FLT_EPSILON, + @"%@ of item %zi in section %zi (%.0f pt) must be less than or equal to container (%.0f pt) accounting for section insets %@", + self.scrollDirection == UICollectionViewScrollDirectionVertical ? @"Width" : @"Height", + item, + section, + CGSizeGetLengthInDirection(size, fixedDirection), + CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection), + NSStringFromUIEdgeInsets(insets)); CGFloat itemLengthInFixedDirection = MIN(CGSizeGetLengthInDirection(size, fixedDirection), paddedLengthInFixedDirection);