Add asserts to IGListAdapter

Summary:
Fix #91
Closes https://github.com/Instagram/IGListKit/pull/108

Differential Revision: D4063183

Pulled By: rnystrom

fbshipit-source-id: 8ff4a5ac3bf7418cb968093e9f87b7fc55bc2fe1
This commit is contained in:
Bofei Zhu
2016-10-21 19:46:42 -07:00
committed by Facebook Github Bot
parent adbb21fd9d
commit a01e9954e3

View File

@@ -715,6 +715,7 @@
IGAssertMainThread();
IGParameterAssert(sectionController != nil);
IGParameterAssert(cellClass != nil);
IGParameterAssert(index >= 0);
UICollectionView *collectionView = self.collectionView;
IGAssert(collectionView != nil, @"Reloading adapter without a collection view.");
NSString *identifier = IGListReusableViewIdentifier(cellClass, nil, nil);
@@ -731,7 +732,9 @@
forSectionController:(IGListSectionController<IGListSectionType> *)sectionController
atIndex:(NSInteger)index {
IGAssertMainThread();
IGParameterAssert(nibName != nil);
IGParameterAssert(sectionController != nil);
IGParameterAssert(index >= 0);
UICollectionView *collectionView = self.collectionView;
IGAssert(collectionView != nil, @"Reloading adapter without a collection view.");
NSIndexPath *indexPath = [self indexPathForSectionController:sectionController index:index];
@@ -748,6 +751,10 @@
class:(Class)viewClass
atIndex:(NSInteger)index {
IGAssertMainThread();
IGParameterAssert(elementKind.length > 0);
IGParameterAssert(sectionController != nil);
IGParameterAssert(viewClass != nil);
IGParameterAssert(index >= 0);
UICollectionView *collectionView = self.collectionView;
IGAssert(collectionView != nil, @"Reloading adapter without a collection view.");
NSString *identifier = IGListReusableViewIdentifier(viewClass, nil, elementKind);