@@ -25,48 +25,62 @@ static CGFloat UIEdgeInsetsLeadingInsetInDirection(UIEdgeInsets insets, UICollec
25
25
switch (direction) {
26
26
case UICollectionViewScrollDirectionVertical: return insets.top ;
27
27
case UICollectionViewScrollDirectionHorizontal: return insets.left ;
28
+ default : /* unexpected */
29
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
28
30
}
29
31
}
30
32
31
33
static CGFloat UIEdgeInsetsTrailingInsetInDirection (UIEdgeInsets insets, UICollectionViewScrollDirection direction) {
32
34
switch (direction) {
33
35
case UICollectionViewScrollDirectionVertical: return insets.bottom ;
34
36
case UICollectionViewScrollDirectionHorizontal: return insets.right ;
37
+ default : /* unexpected */
38
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
35
39
}
36
40
}
37
41
38
42
static CGFloat CGPointGetCoordinateInDirection (CGPoint point, UICollectionViewScrollDirection direction) {
39
43
switch (direction) {
40
44
case UICollectionViewScrollDirectionVertical: return point.y ;
41
45
case UICollectionViewScrollDirectionHorizontal: return point.x ;
46
+ default : /* unexpected */
47
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
42
48
}
43
49
}
44
50
45
51
static CGFloat CGRectGetLengthInDirection (CGRect rect, UICollectionViewScrollDirection direction) {
46
52
switch (direction) {
47
53
case UICollectionViewScrollDirectionVertical: return rect.size .height ;
48
54
case UICollectionViewScrollDirectionHorizontal: return rect.size .width ;
55
+ default : /* unexpected */
56
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
49
57
}
50
58
}
51
59
52
60
static CGFloat CGRectGetMaxInDirection (CGRect rect, UICollectionViewScrollDirection direction) {
53
61
switch (direction) {
54
62
case UICollectionViewScrollDirectionVertical: return CGRectGetMaxY (rect);
55
63
case UICollectionViewScrollDirectionHorizontal: return CGRectGetMaxX (rect);
64
+ default : /* unexpected */
65
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
56
66
}
57
67
}
58
68
59
69
static CGFloat CGRectGetMinInDirection (CGRect rect, UICollectionViewScrollDirection direction) {
60
70
switch (direction) {
61
71
case UICollectionViewScrollDirectionVertical: return CGRectGetMinY (rect);
62
72
case UICollectionViewScrollDirectionHorizontal: return CGRectGetMinX (rect);
73
+ default : /* unexpected */
74
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
63
75
}
64
76
}
65
77
66
78
static CGFloat CGSizeGetLengthInDirection (CGSize size, UICollectionViewScrollDirection direction) {
67
79
switch (direction) {
68
80
case UICollectionViewScrollDirectionVertical: return size.height ;
69
81
case UICollectionViewScrollDirectionHorizontal: return size.width ;
82
+ default : /* unexpected */
83
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, direction);
70
84
}
71
85
}
72
86
@@ -77,9 +91,11 @@ static CGFloat CGSizeGetLengthInDirection(CGSize size, UICollectionViewScrollDir
77
91
static NSInteger IGListMergeMinimumInvalidatedSection (NSInteger section, NSInteger otherSection) {
78
92
if (section == NSNotFound && otherSection == NSNotFound ) {
79
93
return NSNotFound ;
80
- } else if (section == NSNotFound ) {
94
+ }
95
+ if (section == NSNotFound ) {
81
96
return otherSection;
82
- } else if (otherSection == NSNotFound ) {
97
+ }
98
+ if (otherSection == NSNotFound ) {
83
99
return section;
84
100
}
85
101
@@ -331,6 +347,8 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind
331
347
case UICollectionViewScrollDirectionHorizontal:
332
348
frame.origin .x = offset;
333
349
break ;
350
+ default : /* unexpected */
351
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, self.scrollDirection );
334
352
}
335
353
}
336
354
} else if ([elementKind isEqualToString: UICollectionElementKindSectionFooter]) {
@@ -370,6 +388,8 @@ - (CGSize)collectionViewContentSize {
370
388
case UICollectionViewScrollDirectionHorizontal:
371
389
return CGSizeMake (CGRectGetMaxX (section.bounds ) + section.insets .right ,
372
390
CGRectGetHeight (collectionView.bounds ) - contentInset.top - contentInset.bottom );
391
+ default : /* unexpected */
392
+ IGLK_UNEXPECTED_SWITCH_CASE_ABORT (UICollectionViewScrollDirection, self.scrollDirection );
373
393
}
374
394
}
375
395
0 commit comments