我在我的 IOS 应用程序中使用 Async 并且需要 CollectionView 的流畅滚动,所以我尝试使用似乎可以平滑滚动的 ASyncDisplayKit。
所有示例都是用 ObjectiveC 制作的,我想翻译这部分代码:
- (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
{
PhotoModel *photoModel = [_photoFeed objectAtIndex:indexPath.row];
// this will be executed on a background thread - important to make sure it's thread safe
ASCellNode *(^ASCellNodeBlock)() = ^ASCellNode *() {
PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhotoObject:photoModel];
return cellNode;
};
return ASCellNodeBlock;
}
谁能帮我用 Swift 翻译这段代码?