Skip to content

Commit

Permalink
Fix loading items in ASDKGram IGListKit example (#1300)
Browse files Browse the repository at this point in the history
  • Loading branch information
maicki committed Jan 10, 2019
1 parent 52b84ba commit 5212d02
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions examples/ASDKgram/Sample/PhotoFeedSectionController.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ - (void)beginBatchFetchWithContext:(ASBatchContext *)context
[self setItems:newItems animated:NO completion:nil];
}

// Start the fetch, then update the items (removing the spinner) when they are loaded.
[_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){
[self setItems:_photoFeed.photos animated:NO completion:^{
[context completeBatchFetching:YES];
}];
} numResultsToReturn:20];
// Push to next runloop to give time to insert the spinner
dispatch_async(dispatch_get_main_queue(), ^{
// Start the fetch, then update the items (removing the spinner) when they are loaded.
[_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){
[self setItems:_photoFeed.photos animated:NO completion:^{
[context completeBatchFetching:YES];
}];
} numResultsToReturn:20];
});
});
}

Expand Down

0 comments on commit 5212d02

Please sign in to comment.