Skip to content

Commit

Permalink
Remove unnecessary availability checks.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 395404364
  • Loading branch information
Jeff Verkoeyen authored and material-automation committed Sep 8, 2021
1 parent 347c1dc commit 59e96f8
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/collections/src/NICollectionViewModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -184,27 +184,23 @@ - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView
#pragma mark - UICollectionViewDataSourcePrefetching

- (void)collectionView:(UICollectionView *)collectionView prefetchItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths {
if (@available(iOS 10.0, *)) {
NSMutableArray<id>* objects = [NSMutableArray array];
for (NSIndexPath* indexPath in indexPaths) {
id object = [self objectAtIndexPath:indexPath];
[objects addObject:object];
}

[self.delegate collectionViewModel:self collectionView:collectionView prefetchItemsAtIndexPaths:indexPaths withObjects:objects];
NSMutableArray<id>* objects = [NSMutableArray array];
for (NSIndexPath* indexPath in indexPaths) {
id object = [self objectAtIndexPath:indexPath];
[objects addObject:object];
}

[self.delegate collectionViewModel:self collectionView:collectionView prefetchItemsAtIndexPaths:indexPaths withObjects:objects];
}

- (void)collectionView:(UICollectionView *)collectionView cancelPrefetchingForItemsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths {
if (@available(iOS 10.0, *)) {
NSMutableArray<id>* objects = [NSMutableArray array];
for (NSIndexPath* indexPath in indexPaths) {
id object = [self objectAtIndexPath:indexPath];
[objects addObject:object];
}

[self.delegate collectionViewModel:self collectionView:collectionView cancelPrefetchingItemsAtIndexPaths:indexPaths withObjects:objects];
NSMutableArray<id>* objects = [NSMutableArray array];
for (NSIndexPath* indexPath in indexPaths) {
id object = [self objectAtIndexPath:indexPath];
[objects addObject:object];
}

[self.delegate collectionViewModel:self collectionView:collectionView cancelPrefetchingItemsAtIndexPaths:indexPaths withObjects:objects];
}

#pragma mark - Public
Expand Down

0 comments on commit 59e96f8

Please sign in to comment.