Minor Collection Simplifications (#2906)

* Minor collection simplifications

* Remove didChangeCollectionViewDataSource call, restrict subclassing ASCollectionViewFlowLayoutInspector
This commit is contained in:
Adlai Holler
2017-01-19 13:57:03 -08:00
committed by GitHub
parent d41ef55cd7
commit e69a475d2b
4 changed files with 14 additions and 26 deletions

View File

@@ -29,10 +29,6 @@
unsigned int implementsConstrainedSizeForNodeAtIndexPathDeprecated:1;
unsigned int implementsConstrainedSizeForItemAtIndexPath:1;
} _delegateFlags;
struct {
unsigned int implementsNumberOfSectionsInCollectionView:1;
} _dataSourceFlags;
}
#pragma mark Lifecycle
@@ -44,7 +40,6 @@
self = [super init];
if (self != nil) {
[self didChangeCollectionViewDataSource:collectionView.asyncDataSource];
[self didChangeCollectionViewDelegate:collectionView.asyncDelegate];
_layout = flowLayout;
}
@@ -65,15 +60,6 @@
}
}
- (void)didChangeCollectionViewDataSource:(id<ASCollectionDataSource>)dataSource
{
if (dataSource == nil) {
memset(&_dataSourceFlags, 0, sizeof(_dataSourceFlags));
} else {
_dataSourceFlags.implementsNumberOfSectionsInCollectionView = [dataSource respondsToSelector:@selector(numberOfSectionsInCollectionView:)];
}
}
- (ASSizeRange)collectionView:(ASCollectionView *)collectionView constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath
{
if (_delegateFlags.implementsConstrainedSizeForItemAtIndexPath) {