mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Minor Collection Simplifications (#2906)
* Minor collection simplifications * Remove didChangeCollectionViewDataSource call, restrict subclassing ASCollectionViewFlowLayoutInspector
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user