2019-12-19 17:32:49 +00:00
|
|
|
/*
|
2018-11-01 17:56:41 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2016-09-07 22:37:59 +00:00
|
|
|
*
|
2019-12-19 17:32:49 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2016-09-07 22:37:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#import "IGTestSingleItemDataSource.h"
|
|
|
|
|
|
|
|
|
|
#import <IGListKit/IGListSingleSectionController.h>
|
|
|
|
|
|
|
|
|
|
#import "IGTestCell.h"
|
|
|
|
|
|
|
|
|
|
@implementation IGTestSingleItemDataSource
|
|
|
|
|
|
|
|
|
|
- (NSArray *)objectsForListAdapter:(IGListAdapter *)listAdapter {
|
|
|
|
|
return self.objects;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-19 15:17:56 +00:00
|
|
|
- (IGListSectionController *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object {
|
2016-09-07 22:37:59 +00:00
|
|
|
void (^configureBlock)(id, __kindof UICollectionViewCell *) = ^(IGTestObject *item, IGTestCell *cell) {
|
|
|
|
|
cell.label.text = [item.value description];
|
|
|
|
|
};
|
2016-11-01 17:55:35 +00:00
|
|
|
CGSize (^sizeBlock)(id, id<IGListCollectionContext>) = ^CGSize(IGTestObject *item, id<IGListCollectionContext> collectionContext) {
|
2016-09-07 22:37:59 +00:00
|
|
|
return CGSizeMake([collectionContext containerSize].width, 44);
|
|
|
|
|
};
|
|
|
|
|
return [[IGListSingleSectionController alloc] initWithCellClass:IGTestCell.class
|
2016-10-15 01:46:16 +00:00
|
|
|
configureBlock:configureBlock
|
|
|
|
|
sizeBlock:sizeBlock];
|
2016-09-07 22:37:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (nullable UIView *)emptyViewForListAdapter:(IGListAdapter *)listAdapter {
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|