# IGListBatchContext Protocol Reference

# IGListBatchContext

Objective-C

    @protocol IGListBatchContext <NSObject>

Swift

    protocol ListBatchContext : NSObjectProtocol

Objects conforming to the IGListBatchContext protocol provide a way for section controllers to mutate their cells or reload everything within the section.

- `-reloadInSectionController:atIndexes:`

  Reloads cells in the section controller.

  #### Declaration

  Objective-C

      - (void)reloadInSectionController:
                  (nonnull IGListSectionController *)sectionController
                              atIndexes:(nonnull NSIndexSet *)indexes;

  Swift

      func reload(in sectionController: IGListSectionController, at indexes: IndexSet)

  #### Parameters

  `sectionController` | The section controller who’s cells need reloading.
  `indexes` | The indexes of items that need reloading.

- `-insertInSectionController:atIndexes:`

  Inserts cells in the list.

  #### Declaration

  Objective-C

      - (void)insertInSectionController:
                  (nonnull IGListSectionController *)sectionController
                              atIndexes:(nonnull NSIndexSet *)indexes;

  Swift

      func insert(in sectionController: IGListSectionController, at indexes: IndexSet)

  #### Parameters

  `sectionController` | The section controller who’s cells need inserting.
  `indexes` | The indexes of items that need inserting.

- `-deleteInSectionController:atIndexes:`

  Deletes cells in the list.

  #### Declaration

  Objective-C

      - (void)deleteInSectionController:
                  (nonnull IGListSectionController *)sectionController
                              atIndexes:(nonnull NSIndexSet *)indexes;

  Swift

      func delete(in sectionController: IGListSectionController, at indexes: IndexSet)

  #### Parameters

  `sectionController` | The section controller who’s cells need deleted.
  `indexes` | The indexes of items that need deleting.

- `-invalidateLayoutInSectionController:atIndexes:`

  Invalidates layouts of cells at specific in the section controller.

  #### Declaration

  Objective-C

      - (void)invalidateLayoutInSectionController:
                  (nonnull IGListSectionController *)sectionController
                                        atIndexes:(nonnull NSIndexSet *)indexes;

  Swift

      func invalidateLayout(in sectionController: IGListSectionController, at indexes: IndexSet)

  #### Parameters

  `sectionController` | The section controller who’s cells need invalidating.
  `indexes` | The indexes of items that need invalidating.

- `-moveInSectionController:fromIndex:toIndex:`

  Moves a cell from one index to another within the section controller.

  #### Declaration

  Objective-C

      - (void)moveInSectionController:
                  (nonnull IGListSectionController *)sectionController
                            fromIndex:(NSInteger)fromIndex
                              toIndex:(NSInteger)toIndex;

  Swift

      func move(in sectionController: IGListSectionController, from fromIndex: Int, to toIndex: Int)

  #### Parameters

  `sectionController` | The section controller who’s cell needs moved.
  `fromIndex` | The index the cell is currently in.
  `toIndex` | The index the cell should move to.

- `-reloadSectionController:`

  Reloads the entire section controller.

  #### Declaration

  Objective-C

      - (void)reloadSectionController:
          (nonnull IGListSectionController *)sectionController;

  Swift

      func reload(_ sectionController: IGListSectionController)

  #### Parameters

  `sectionController` | The section controller who’s cells need reloading.

- `-moveSectionControllerInteractive:fromIndex:toIndex:`

  Moves a section controller from one index to another during interactive reordering.

  #### Declaration

  Objective-C

      - (void)moveSectionControllerInteractive:
                  (nonnull IGListSectionController *)sectionController
                                     fromIndex:(NSInteger)fromIndex
                                       toIndex:(NSInteger)toIndex;

  Swift

      func moveSectionControllerInteractive(_ sectionController: IGListSectionController, from fromIndex: Int, to toIndex: Int)

  #### Parameters

  `sectionController` | The section controller to move.
  `fromIndex` | The index where the section currently resides.
  `toIndex` | The index the section should move to.

- `-moveInSectionControllerInteractive:fromIndex:toIndex:`

  Moves an object within a section controller from one index to another during interactive reordering.

  #### Declaration

  Objective-C

      - (void)moveInSectionControllerInteractive:
                  (nonnull IGListSectionController *)sectionController
                                       fromIndex:(NSInteger)fromIndex
                                         toIndex:(NSInteger)toIndex;

  Swift

      func move(inSectionControllerInteractive sectionController: IGListSectionController, from fromIndex: Int, to toIndex: Int)

  #### Parameters

  `sectionController` | The section controller containing the object to move.
  `fromIndex` | The index where the object currently resides.
  `toIndex` | The index the object should move to.

- `-revertInvalidInteractiveMoveFromIndexPath:toIndexPath:`

  Reverts an move from one indexPath to another during interactive reordering.

  #### Declaration

  Objective-C

      - (void)revertInvalidInteractiveMoveFromIndexPath:
                  (nonnull NSIndexPath *)sourceIndexPath
                                            toIndexPath:(nonnull NSIndexPath *)
                                                            destinationIndexPath;

  Swift

      func revertInvalidInteractiveMove(from sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)

  #### Parameters

  `sourceIndexPath` | The indexPath the item was originally in.
  `destinationIndexPath` | The indexPath the item was moving to.

© 2024 Instagram. All rights reserved. (Last updated: 2024-05-13)

Generated by jazzy ♪♫ v0.15.0, a Realm project.