IGListKit/Source/IGListCollectionViewLayoutCompatible.h
Jordan Smith 46a124ddfe Define IGListCollectionViewLayoutCompatible to allow custom layouts to interact with IGListCollectionView
Summary: This change allows arbitrary layouts to be used in tandem with IGListCollectionView and recieve udpated section indices, by conforming to to conform IGListCollectionViewLayoutCompatible.

Reviewed By: maxoll

Differential Revision: D13671204

fbshipit-source-id: e030f413aefff71754731d1259037077ffb73959
2019-01-17 07:53:23 -08:00

33 lines
1.2 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 <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
A protocol for layouts that defines interaction with an IGListCollectionView, for recieving updated section indexes.
*/
NS_SWIFT_NAME(ListCollectionViewLayoutCompatible)
@protocol IGListCollectionViewLayoutCompatible <NSObject>
/**
Called to notify the layout that a specific section was modified before invalidation. This can be used to optimize
layout re-calculation.
@note When updating a collection view (ex: calling `-insertSections`), `-invalidateLayoutWithContext` gets called on
the layout object. However, the invalidation context doesn't provide details on which index paths are being modified,
which typically forces a full layout re-calculation. Layouts can use this method to keep track of which section
actually needs to be updated on the following `-invalidateLayoutWithContext`. See `IGListCollectionView`.
@param modifiedSection The section that was modified.
*/
- (void)didModifySection:(NSInteger)modifiedSection;
@end
NS_ASSUME_NONNULL_END