mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
[ASCollectionNode] add -indexPathsForVisibleNodes (#2451)
This commit is contained in:
committed by
Adlai Holler
parent
9719357901
commit
15aa784fe8
@@ -313,6 +313,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*/
|
*/
|
||||||
- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT;
|
- (nullable NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode AS_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the index paths of all visible items.
|
||||||
|
*
|
||||||
|
* @return an array containing the index paths of all visible items. This must be called on the main thread.
|
||||||
|
*/
|
||||||
|
- (NSArray<__kindof NSIndexPath *> *)indexPathsForVisibleItems AS_WARN_UNUSED_RESULT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the context object for the given section, as provided by the data source in
|
* Retrieves the context object for the given section, as provided by the data source in
|
||||||
|
|||||||
@@ -295,6 +295,19 @@
|
|||||||
return [self.dataController indexPathForNode:cellNode];
|
return [self.dataController indexPathForNode:cellNode];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray<__kindof NSIndexPath *> *)indexPathsForVisibleItems
|
||||||
|
{
|
||||||
|
NSMutableArray *indexPathsArray = [NSMutableArray new];
|
||||||
|
for (ASCellNode *cell in [self visibleNodes]) {
|
||||||
|
NSIndexPath *indexPath = [self indexPathForNode:cell];
|
||||||
|
if (indexPath) {
|
||||||
|
[indexPathsArray addObject:indexPath];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return indexPathsArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath
|
- (ASCellNode *)nodeForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||||
{
|
{
|
||||||
return [self.dataController nodeAtIndexPath:indexPath];
|
return [self.dataController nodeAtIndexPath:indexPath];
|
||||||
|
|||||||
Reference in New Issue
Block a user