mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-16 05:48:18 +00:00
Summary: We constantly have random bugs pop up when mutations are made outside of a batch update. This change restricts the mutation API to a batch context object (which is just an `IGListAdapter`) so they can only be done **inside an update block**. - Fixed open source project - Confirmed open source examples build - Updated all of Instagram.app to use this API - Changelog breaking changes entry Fixes #392 Reviewed By: jessesquires Differential Revision: D4754129 fbshipit-source-id: 11d32a0fac3e50c9edbb01e92a8a0c7b8a43cf2d
67 lines
2.3 KiB
Objective-C
67 lines
2.3 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 <Foundation/Foundation.h>
|
|
|
|
@class IGListSectionController;
|
|
|
|
@protocol IGListSectionType;
|
|
|
|
/**
|
|
Objects conforming to the IGListBatchContext protocol provide a way for section controllers to mutate their cells or
|
|
reload everything within the section.
|
|
*/
|
|
@protocol IGListBatchContext <NSObject>
|
|
|
|
/**
|
|
Reloads cells in the section controller.
|
|
|
|
@param sectionController The section controller who's cells need reloading.
|
|
@param indexes The indexes of items that need reloading.
|
|
*/
|
|
- (void)reloadInSectionController:(IGListSectionController<IGListSectionType> *)sectionController
|
|
atIndexes:(NSIndexSet *)indexes;
|
|
|
|
/**
|
|
Inserts cells in the list.
|
|
|
|
@param sectionController The section controller who's cells need inserting.
|
|
@param indexes The indexes of items that need inserting.
|
|
*/
|
|
- (void)insertInSectionController:(IGListSectionController<IGListSectionType> *)sectionController
|
|
atIndexes:(NSIndexSet *)indexes;
|
|
|
|
/**
|
|
Deletes cells in the list.
|
|
|
|
@param sectionController The section controller who's cells need deleted.
|
|
@param indexes The indexes of items that need deleting.
|
|
*/
|
|
- (void)deleteInSectionController:(IGListSectionController<IGListSectionType> *)sectionController
|
|
atIndexes:(NSIndexSet *)indexes;
|
|
|
|
/**
|
|
Moves a cell from one index to another within the section controller.
|
|
|
|
@param sectionController The section controller who's cell needs moved.
|
|
@param fromIndex The index the cell is currently in.
|
|
@param toIndex The index the cell should move to.
|
|
*/
|
|
- (void)moveInSectionController:(IGListSectionController<IGListSectionType> *)sectionController
|
|
fromIndex:(NSInteger)fromIndex
|
|
toIndex:(NSInteger)toIndex;
|
|
|
|
/**
|
|
Reloads the entire section controller.
|
|
|
|
@param sectionController The section controller who's cells need reloading.
|
|
*/
|
|
- (void)reloadSectionController:(IGListSectionController<IGListSectionType> *)sectionController;
|
|
|
|
@end
|