mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Add assert for ASCollectionDataSource implementing collectionView:constrainedSizeForNodeAtIndexPath: instead of ASCollectionDelegate (#2165)
This commit is contained in:
committed by
Adlai Holler
parent
8d86bb6db3
commit
1849c41b03
@@ -63,6 +63,9 @@ static inline ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView
|
||||
{
|
||||
if (_delegateFlags.implementsConstrainedSizeForNodeAtIndexPath) {
|
||||
return [collectionView.asyncDelegate collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath];
|
||||
} else {
|
||||
// With 2.0 `collectionView:constrainedSizeForNodeAtIndexPath:` was moved to the delegate. Assert if not implemented on the delegate but on the data source
|
||||
ASDisplayNodeAssert([collectionView.asyncDataSource respondsToSelector:@selector(collectionView:constrainedSizeForNodeAtIndexPath:)] == NO, @"collectionView:constrainedSizeForNodeAtIndexPath: was moved from the ASCollectionDataSource to the ASCollectionDataSource.");
|
||||
}
|
||||
|
||||
return NodeConstrainedSizeForScrollDirection(collectionView);
|
||||
@@ -143,6 +146,9 @@ static inline ASSizeRange NodeConstrainedSizeForScrollDirection(ASCollectionView
|
||||
{
|
||||
if (_delegateFlags.implementsConstrainedSizeForNodeAtIndexPath) {
|
||||
return [collectionView.asyncDelegate collectionView:collectionView constrainedSizeForNodeAtIndexPath:indexPath];
|
||||
} else {
|
||||
// With 2.0 `collectionView:constrainedSizeForNodeAtIndexPath:` was moved to the delegate. Assert if not implemented on the delegate but on the data source
|
||||
ASDisplayNodeAssert([collectionView.asyncDataSource respondsToSelector:@selector(collectionView:constrainedSizeForNodeAtIndexPath:)] == NO, @"collectionView:constrainedSizeForNodeAtIndexPath: was moved from the ASCollectionDataSource to the ASCollectionDataSource.");
|
||||
}
|
||||
|
||||
CGSize itemSize = _layout.itemSize;
|
||||
|
||||
Reference in New Issue
Block a user