IGListKit/Tests/Objects/IGTestDelegateDataSource.m
Maxime Ollivier 3f1a2fb0ac unit test missing section-controller fix
Summary: Lets test that the new updater (`IGListExperimentalAdapterUpdater`) can handle a missing section-controller. The old adapater `IGListAdapterUpdater` would crash.

Reviewed By: patters

Differential Revision: D23145773

fbshipit-source-id: 4589dcb11ddef5c7400947aea4b6827f1b2caaa8
2020-09-08 09:11:12 -07:00

36 lines
1 KiB
Objective-C

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "IGTestDelegateDataSource.h"
#import <IGListKit/IGListAdapter.h>
#import "IGTestDelegateController.h"
#import "IGTestObject.h"
NSObject *const kIGTestDelegateDataSourceSkipObject = @"kIGTestDelegateDataSourceSkipObject";
@implementation IGTestDelegateDataSource
- (NSArray *)objectsForListAdapter:(IGListAdapter *)listAdapter {
return self.objects;
}
- (IGListSectionController *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object {
if ([object isEqual:kIGTestDelegateDataSourceSkipObject]) {
return nil;
}
IGTestDelegateController *sectionController = [[IGTestDelegateController alloc] init];
sectionController.cellConfigureBlock = self.cellConfigureBlock;
return sectionController;
}
- (nullable UIView *)emptyViewForListAdapter:(IGListAdapter *)listAdapter {
return nil;
}
@end