Ich verwende Async in meiner IOS-App und brauche ein flüssiges Scrollen für die CollectionView, also versuche ich ASyncDisplayKit zu verwenden, das scheinbar glattes Scrollen hat.Async-Aufruf in nodeBlockForRowAtIndexPath
Alle Proben in Objective gemacht werden, würde Ich mag diesen Teil des Codes übersetzen:
- (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;
}
Kann mir jemand helfen, diesen Code in Swift bei der Übersetzung?
Welche Art von Objekt ist '_photoFeed'. 'NSArray'? –
Ja, es ist ein Array, das Daten aus einem Rest-Service enthält – Cris