Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions AsyncDisplayKit/ASCollectionView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -391,15 +391,19 @@ - (NSArray *)visibleNodes
{
NSArray *indexPaths = [self indexPathsForVisibleItems];
NSMutableArray *visibleNodes = [[NSMutableArray alloc] init];

[indexPaths enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
ASCellNode *visibleNode = [self nodeForItemAtIndexPath:obj];
[visibleNodes addObject:visibleNode];
}];


for (NSIndexPath *indexPath in indexPaths) {
ASCellNode *node = [self nodeForItemAtIndexPath:indexPath];
if (node) {
// It is possible for UICollectionView to return indexPaths before the node is completed.
[visibleNodes addObject:node];
}
}

return visibleNodes;
}


#pragma mark Assertions.

- (void)performBatchAnimated:(BOOL)animated updates:(void (^)())updates completion:(void (^)(BOOL))completion
Expand Down
13 changes: 8 additions & 5 deletions AsyncDisplayKit/ASTableView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,14 @@ - (NSArray *)visibleNodes
NSArray *indexPaths = [self indexPathsForVisibleRows];
NSMutableArray *visibleNodes = [[NSMutableArray alloc] init];

[indexPaths enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
ASCellNode *visibleNode = [self nodeForRowAtIndexPath:obj];
[visibleNodes addObject:visibleNode];
}];

for (NSIndexPath *indexPath in indexPaths) {
ASCellNode *node = [self nodeForRowAtIndexPath:indexPath];
if (node) {
// It is possible for UITableView to return indexPaths before the node is completed.
[visibleNodes addObject:node];
}
}

return visibleNodes;
}

Expand Down
15 changes: 14 additions & 1 deletion AsyncDisplayKit/Details/ASDataController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,20 @@ - (NSUInteger)numberOfRowsInSection:(NSUInteger)section
- (ASCellNode *)nodeAtIndexPath:(NSIndexPath *)indexPath
{
ASDisplayNodeAssertMainThread();
return [self completedNodes][indexPath.section][indexPath.row];

NSArray *completedNodes = [self completedNodes];
NSInteger section = indexPath.section;
NSInteger row = indexPath.row;
ASCellNode *node = nil;

if (section >= 0 && row >= 0 && section < completedNodes.count) {
NSArray *completedNodesSection = completedNodes[section];
if (row < completedNodesSection.count) {
node = completedNodesSection[row];
}
}

return node;
}

- (NSIndexPath *)indexPathForNode:(ASCellNode *)cellNode;
Expand Down
16 changes: 0 additions & 16 deletions examples/ASTableViewStressTest/Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
05E2127E19D4DB510098F589 /* Frameworks */,
05E2127F19D4DB510098F589 /* Resources */,
F012A6F39E0149F18F564F50 /* Copy Pods Resources */,
E671F9E92DFB9088485E493B /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -190,21 +189,6 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
E671F9E92DFB9088485E493B /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
F012A6F39E0149F18F564F50 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down