Skip to content

Commit

Permalink
Remove iOS 7 UICollectionView delegate API support
Browse files Browse the repository at this point in the history
Summary: Don't need support for iOS 7 anymore, save some cycles on layout.

Reviewed By: ocrickard

Differential Revision: D4098229

fbshipit-source-id: eeaaf875acda1229f9622f11acc7c77ccad75cf0
  • Loading branch information
Ryan Nystrom authored and Facebook Github Bot committed Oct 29, 2016
1 parent e4a4719 commit 9e8ad96
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions Source/IGListCollectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,11 @@

#import "IGListCollectionView.h"

@interface IGListCollectionView ()

@property (nonatomic, assign, readonly) BOOL requiresManualWillDisplay;
@property (nonatomic, strong) NSSet *ig_visibleIndexPaths;

@end

@implementation IGListCollectionView

- (void)commonInit {
self.backgroundColor = [UIColor whiteColor];
self.alwaysBounceVertical = YES;

// iOS 6 and 7 do not support -collectionView:willDisplayCell:forItemAtIndexPath: so we do it ourselves
_requiresManualWillDisplay = [[[UIDevice currentDevice] systemVersion] floatValue] < 8.0;
}

- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
Expand All @@ -49,17 +39,6 @@ - (void)layoutSubviews {
[UIView performWithoutAnimation:^{
[super layoutSubviews];
}];

if (self.requiresManualWillDisplay && [self.delegate respondsToSelector:@selector(collectionView:willDisplayCell:forItemAtIndexPath:)]) {
NSArray *indexPaths = [self indexPathsForVisibleItems];
for (NSIndexPath *path in indexPaths) {
if (![self.ig_visibleIndexPaths containsObject:path]) {
UICollectionViewCell *cell = [self cellForItemAtIndexPath:path];
[self.delegate collectionView:self willDisplayCell:cell forItemAtIndexPath:path];
}
}
self.ig_visibleIndexPaths = [NSSet setWithArray:indexPaths];
}
}

@end

2 comments on commit 9e8ad96

@PhilCai1993
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG, I didn't even notice this delegate is only supported on iOS 8 and above!!!

@jessesquires
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PhilCai1993 - yep 😊 Another reason I'd encourage you to drop iOS 7 😄

Please sign in to comment.