IGListKit/Source/IGListStackedSectionController.h
Qinghua Hong 08bf69cc2f Fix #1275 layouts inconsistency in updateAnimated:completion of IGListBindingSectionController (#1285)
Summary:
## Changes in this pull request

Issue fixed: https://github.com/Instagram/IGListKit/issues/1275

This PR is straintforward solution as mentioned in https://github.com/Instagram/IGListKit/issues/1275. When I finished it, I realized that it is not a problem in `IGListCollectionViewLayout Partial Optimization` and `IGListBindingSectionController` deserved it. Maybe `IGListCollectionViewLayout` is rarely used because of great builtin UICollectionViewFlowLayout or cells in section rarely need changing their sizes in practices.

Despite it is not `IGListCollectionViewLayout`'s fault, I think it can be more optimized against `invalidateLayoutWithContext`. I would like to make an another PR to optimize it.

Due to this PR just giving a proposed solution, it lacks of adding tests and changing log. When this solution is accepted, I would like to complete these todos.

### Checklist

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
- [x] 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)
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1285

Reviewed By: candance

Differential Revision: D15592807

Pulled By: lorixx

fbshipit-source-id: ae06abce896341509de4f3dfb73b3a7bc0a68c51
2019-06-11 22:29:34 -07:00

57 lines
1.8 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 <IGListKit/IGListSectionController.h>
#import <IGListKit/IGListExperiments.h>
#import <IGListKit/IGListMacros.h>
NS_ASSUME_NONNULL_BEGIN
/**
An instance of `IGListStackedSectionController` is a clustered section controller, composed of many child section
controllers. It constructs and routes item-level indexes to the appropriate child section controller with a local
index. This lets you build section controllers made up of individual units that can be shared and reused with other
section controllers.
For example, you can create a "Comments" section controller that displays lists of text that is used alongside photo,
video, or slideshow section controllers. You then have four small and manageable section controllers instead of one
huge class.
*/
IGLK_SUBCLASSING_RESTRICTED
NS_SWIFT_NAME(ListStackedSectionController)
@interface IGListStackedSectionController : IGListSectionController
/**
A bitmask of experiments to conduct on the section controller.
*/
@property (nonatomic, assign) IGListExperiment experiments;
/**
Creates a new stacked section controller.
@param sectionControllers An array of section controllers that make up the stack.
@note The order of the section controllers dictates the order in which they appear.
@warning The first section controller that is the supplementary source decides which supplementary views get displayed.
*/
- (instancetype)initWithSectionControllers:(NSArray <IGListSectionController *> *)sectionControllers NS_DESIGNATED_INITIALIZER;
/**
:nodoc:
*/
- (instancetype)init NS_UNAVAILABLE;
/**
:nodoc:
*/
+ (instancetype)new NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END