--- title: Prefer `nodeBlocks` for Performance layout: docs permalink: /docs/tip-1-nodeBlocks.html --- Texture’s `ASCollectionNode` replaces `UICollectionView`’s required method
collectionView:cellForItemAtIndexPath:
// called on main thread, ASCellNode initialized on main and then returned
collectionNode:nodeForItemAtIndexPath:
OR
// called on main thread, ASCellNodeBlock returned, then
// ASCellNode initialized in background when block is called by system
collectionNode:nodeBlockForItemAtIndexPath:
`tableNode:nodeForRow:`
`tableNode:nodeBlockforRow:` // preferred
`pagerNode:nodeAtIndex:`
`pagerNode:nodeBlockAtIndex:` // preferred
- (ASCellNodeBlock)collectionNode:(ASCollectionNode *)collectionNode nodeBlockForItemAtIndexPath:(NSIndexPath *)indexPath
{
// data model is accessed outside of the node block
Board *board = [self.boards objectAtIndex:indexPath.item];
return ^{
BoardScrubberCellNode *node = [[BoardScrubberCellNode alloc] initWithBoard:board];
return node;
};
}