IGListKit/Tests/Objects/IGListTestAdapterDataSource.m
Bofei Zhu f7702fa713 Container Inset Size For Section Controller
Summary:
Add API for #315. Not sure if this is what you want rnystrom though 🤔. Will add tests after you confirm.

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [ ] I added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes.
- [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md)
Closes https://github.com/Instagram/IGListKit/pull/456

Reviewed By: jessesquires

Differential Revision: D4697190

Pulled By: rnystrom

fbshipit-source-id: f8513cf2fa33441eb40f486954136553d19dda0c
2017-03-15 09:25:40 -07:00

37 lines
1.1 KiB
Objective-C

/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "IGListTestAdapterDataSource.h"
#import <IGListKit/IGListAdapter.h>
#import "IGListTestSection.h"
#import "IGListTestContainerSizeSection.h"
@implementation IGListTestAdapterDataSource
- (NSArray *)objectsForListAdapter:(IGListAdapter *)listAdapter {
return self.objects;
}
- (IGListSectionController <IGListSectionType> *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object {
if ([object isKindOfClass:[NSNumber class]]) {
if ([(NSNumber*)object isEqual: @42]) {
return [IGListTestContainerSizeSection new];
}
return [IGListTestSection new];
}
return nil;
}
- (nullable UIView *)emptyViewForListAdapter:(IGListAdapter *)listAdapter {
return self.backgroundView;
}
@end