Add ASCellNode type assertions (closes #161).

This commit is contained in:
Nadine Salter 2014-12-16 13:15:28 -08:00
parent b653f75794
commit e754cc2024
2 changed files with 6 additions and 2 deletions

View File

@ -314,7 +314,9 @@ static BOOL _isInterceptedSelector(SEL sel)
- (ASCellNode *)dataController:(ASDataController *)dataController nodeAtIndexPath:(NSIndexPath *)indexPath - (ASCellNode *)dataController:(ASDataController *)dataController nodeAtIndexPath:(NSIndexPath *)indexPath
{ {
return [_asyncDataSource collectionView:self nodeForItemAtIndexPath:indexPath]; ASCellNode *node = [_asyncDataSource collectionView:self nodeForItemAtIndexPath:indexPath];
ASDisplayNodeAssert([node isKindOfClass:ASCellNode.class], @"invalid node class, expected ASCellNode");
return node;
} }
- (CGSize)dataController:(ASDataController *)dataController constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath - (CGSize)dataController:(ASDataController *)dataController constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath

View File

@ -397,7 +397,9 @@ static BOOL _isInterceptedSelector(SEL sel)
#pragma mark - ASDataControllerDelegate #pragma mark - ASDataControllerDelegate
- (ASCellNode *)dataController:(ASDataController *)dataController nodeAtIndexPath:(NSIndexPath *)indexPath { - (ASCellNode *)dataController:(ASDataController *)dataController nodeAtIndexPath:(NSIndexPath *)indexPath {
return [_asyncDataSource tableView:self nodeForRowAtIndexPath:indexPath]; ASCellNode *node = [_asyncDataSource tableView:self nodeForRowAtIndexPath:indexPath];
ASDisplayNodeAssert([node isKindOfClass:ASCellNode.class], @"invalid node class, expected ASCellNode");
return node;
} }
- (CGSize)dataController:(ASDataController *)dataController constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath { - (CGSize)dataController:(ASDataController *)dataController constrainedSizeForNodeAtIndexPath:(NSIndexPath *)indexPath {