@@ -25,48 +25,62 @@ static CGFloat UIEdgeInsetsLeadingInsetInDirection(UIEdgeInsets insets, UICollec
2525 switch (direction) {
2626 case UICollectionViewScrollDirectionVertical: return insets.top ;
2727 case UICollectionViewScrollDirectionHorizontal: return insets.left ;
28+ default : /* unexpected */
29+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
2830 }
2931}
3032
3133static CGFloat UIEdgeInsetsTrailingInsetInDirection (UIEdgeInsets insets, UICollectionViewScrollDirection direction) {
3234 switch (direction) {
3335 case UICollectionViewScrollDirectionVertical: return insets.bottom ;
3436 case UICollectionViewScrollDirectionHorizontal: return insets.right ;
37+ default : /* unexpected */
38+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
3539 }
3640}
3741
3842static CGFloat CGPointGetCoordinateInDirection (CGPoint point, UICollectionViewScrollDirection direction) {
3943 switch (direction) {
4044 case UICollectionViewScrollDirectionVertical: return point.y ;
4145 case UICollectionViewScrollDirectionHorizontal: return point.x ;
46+ default : /* unexpected */
47+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
4248 }
4349}
4450
4551static CGFloat CGRectGetLengthInDirection (CGRect rect, UICollectionViewScrollDirection direction) {
4652 switch (direction) {
4753 case UICollectionViewScrollDirectionVertical: return rect.size .height ;
4854 case UICollectionViewScrollDirectionHorizontal: return rect.size .width ;
55+ default : /* unexpected */
56+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
4957 }
5058}
5159
5260static CGFloat CGRectGetMaxInDirection (CGRect rect, UICollectionViewScrollDirection direction) {
5361 switch (direction) {
5462 case UICollectionViewScrollDirectionVertical: return CGRectGetMaxY (rect);
5563 case UICollectionViewScrollDirectionHorizontal: return CGRectGetMaxX (rect);
64+ default : /* unexpected */
65+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
5666 }
5767}
5868
5969static CGFloat CGRectGetMinInDirection (CGRect rect, UICollectionViewScrollDirection direction) {
6070 switch (direction) {
6171 case UICollectionViewScrollDirectionVertical: return CGRectGetMinY (rect);
6272 case UICollectionViewScrollDirectionHorizontal: return CGRectGetMinX (rect);
73+ default : /* unexpected */
74+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
6375 }
6476}
6577
6678static CGFloat CGSizeGetLengthInDirection (CGSize size, UICollectionViewScrollDirection direction) {
6779 switch (direction) {
6880 case UICollectionViewScrollDirectionVertical: return size.height ;
6981 case UICollectionViewScrollDirectionHorizontal: return size.width ;
82+ default : /* unexpected */
83+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
7084 }
7185}
7286
@@ -77,9 +91,11 @@ static CGFloat CGSizeGetLengthInDirection(CGSize size, UICollectionViewScrollDir
7791static NSInteger IGListMergeMinimumInvalidatedSection (NSInteger section, NSInteger otherSection) {
7892 if (section == NSNotFound && otherSection == NSNotFound ) {
7993 return NSNotFound ;
80- } else if (section == NSNotFound ) {
94+ }
95+ if (section == NSNotFound ) {
8196 return otherSection;
82- } else if (otherSection == NSNotFound ) {
97+ }
98+ if (otherSection == NSNotFound ) {
8399 return section;
84100 }
85101
@@ -331,6 +347,8 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind
331347 case UICollectionViewScrollDirectionHorizontal:
332348 frame.origin .x = offset;
333349 break ;
350+ default : /* unexpected */
351+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, self.scrollDirection );
334352 }
335353 }
336354 } else if ([elementKind isEqualToString: UICollectionElementKindSectionFooter]) {
@@ -370,6 +388,8 @@ - (CGSize)collectionViewContentSize {
370388 case UICollectionViewScrollDirectionHorizontal:
371389 return CGSizeMake (CGRectGetMaxX (section.bounds ) + section.insets .right ,
372390 CGRectGetHeight (collectionView.bounds ) - contentInset.top - contentInset.bottom );
391+ default : /* unexpected */
392+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, self.scrollDirection );
373393 }
374394}
375395
0 commit comments