IGListAdapterUpdaterDelegate

Objective-C

@protocol IGListAdapterUpdaterDelegate <NSObject>

Swift

protocol ListAdapterUpdaterDelegate : NSObjectProtocol

A protocol that receives events about IGListAdapterUpdater operations.

  • Notifies the delegate that the updater is about to beging diffing.

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
           willDiffFromObjects:(nullable NSArray<id<IGListDiffable>> *)fromObjects
                     toObjects:(nullable NSArray<id<IGListDiffable>> *)toObjects;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willDiffFromObjects fromObjects: [any IGListDiffable]?, toObjects: [any IGListDiffable]?)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    fromObjects

    The items transitioned from in the batch updates, if any.

    toObjects

    The items transitioned to in the batch updates, if any.

  • Notifies the delegate that the updater finished diffing.

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
            didDiffWithResults:(nullable IGListIndexSetResult *)listIndexSetResults
            onBackgroundThread:(BOOL)onBackgroundThread;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, didDiffWithResults listIndexSetResults: IGListIndexSetResult?, onBackgroundThread: Bool)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    listIndexSetResults

    The diffing result of indices to be inserted/removed/updated/moved/etc.

    onBackgroundThread

    Was the diffing performed on a background thread

  • Notifies the delegate that the updater will call -[UICollectionView performBatchUpdates:completion:].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
        willPerformBatchUpdatesWithCollectionView:
            (nonnull UICollectionView *)collectionView
                                      fromObjects:
                                          (nullable NSArray<id<IGListDiffable>> *)
                                              fromObjects
                                        toObjects:
                                            (nullable NSArray<id<IGListDiffable>> *)
                                                toObjects
                               listIndexSetResult:(nullable IGListIndexSetResult *)
                                                      listIndexSetResults
                                         animated:(BOOL)animated;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willPerformBatchUpdatesWith collectionView: UICollectionView, fromObjects: [any IGListDiffable]?, toObjects: [any IGListDiffable]?, listIndexSetResult listIndexSetResults: IGListIndexSetResult?, animated: Bool)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    collectionView

    The collection view that will perform the batch updates.

    fromObjects

    The items transitioned from in the batch updates, if any.

    toObjects

    The items transitioned to in the batch updates, if any.

    listIndexSetResults

    The diffing result of indices to be inserted/removed/updated/moved/etc.

    animated

    Is the cell transtion animated

  • Notifies the delegate that the updater successfully finished -[UICollectionView performBatchUpdates:completion:].

    Note

    This event is called in the completion block of the batch update.

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
        didPerformBatchUpdates:(nonnull IGListBatchUpdateData *)updates
                collectionView:(nonnull UICollectionView *)collectionView;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, didPerformBatchUpdates updates: ListBatchUpdateData, collectionView: UICollectionView)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    updates

    The batch updates that were applied to the collection view.

    collectionView

    The collection view that performed the batch updates.

  • Notifies the delegate that the updater will call -[UICollectionView insertItemsAtIndexPaths:].

    Note

    This event is only sent when outside of -[UICollectionView performBatchUpdates:completion:].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
          willInsertIndexPaths:(nonnull NSArray<NSIndexPath *> *)indexPaths
                collectionView:(nonnull UICollectionView *)collectionView;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willInsert indexPaths: [IndexPath], collectionView: UICollectionView)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    indexPaths

    An array of index paths that will be inserted.

    collectionView

    The collection view that will perform the insert.

  • Notifies the delegate that the updater will call -[UICollectionView deleteItemsAtIndexPaths:].

    Note

    This event is only sent when outside of -[UICollectionView performBatchUpdates:completion:].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
          willDeleteIndexPaths:(nonnull NSArray<NSIndexPath *> *)indexPaths
                collectionView:(nonnull UICollectionView *)collectionView;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willDelete indexPaths: [IndexPath], collectionView: UICollectionView)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    indexPaths

    An array of index paths that will be deleted.

    collectionView

    The collection view that will perform the delete.

  • Notifies the delegate that the updater will call -[UICollectionView moveItemAtIndexPath:toIndexPath:]

    Note

    This event is only sent when outside of -[UICollectionView performBatchUpdates:completion:].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
         willMoveFromIndexPath:(nonnull NSIndexPath *)fromIndexPath
                   toIndexPath:(nonnull NSIndexPath *)toIndexPath
                collectionView:(nonnull UICollectionView *)collectionView;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willMoveFrom fromIndexPath: IndexPath, to toIndexPath: IndexPath, collectionView: UICollectionView)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    fromIndexPath

    The index path of the item that will be moved.

    toIndexPath

    The index path to move the item to.

    collectionView

    The collection view that will perform the move.

  • Notifies the delegate that the updater will call -[UICollectionView reloadItemsAtIndexPaths:].

    Note

    This event is only sent when outside of -[UICollectionView performBatchUpdates:completion:].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
          willReloadIndexPaths:(nonnull NSArray<NSIndexPath *> *)indexPaths
                collectionView:(nonnull UICollectionView *)collectionView;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willReload indexPaths: [IndexPath], collectionView: UICollectionView)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    indexPaths

    An array of index paths that will be reloaded.

    collectionView

    The collection view that will perform the reload.

  • Notifies the delegate that the updater will call -[UICollectionView reloadSections:].

    Note

    This event is only sent when outside of -[UICollectionView performBatchUpdates:completion:].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
            willReloadSections:(nonnull NSIndexSet *)sections
                collectionView:(nonnull UICollectionView *)collectionView;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willReloadSections sections: IndexSet, collectionView: UICollectionView)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    sections

    The sections that will be reloaded

    collectionView

    The collection view that will perform the reload.

  • Notifies the delegate that the updater will call -[UICollectionView reloadData].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
        willReloadDataWithCollectionView:(nonnull UICollectionView *)collectionView
                        isFallbackReload:(BOOL)isFallbackReload;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, willReloadDataWith collectionView: UICollectionView, isFallbackReload: Bool)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    collectionView

    The collection view that will be reloaded.

    isFallbackReload

    The reload was a fallback because we could not performBatchUpdate

  • Notifies the delegate that the updater successfully called -[UICollectionView reloadData].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
        didReloadDataWithCollectionView:(nonnull UICollectionView *)collectionView
                       isFallbackReload:(BOOL)isFallbackReload;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, didReloadDataWith collectionView: UICollectionView, isFallbackReload: Bool)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    collectionView

    The collection view that reloaded.

    isFallbackReload

    The reload was a fallback because we could not performBatchUpdate

  • Notifies the delegate that the collection view threw an exception in -[UICollectionView performBatchUpdates:completion:].

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
                collectionView:(nonnull UICollectionView *)collectionView
        willCrashWithException:(nonnull NSException *)exception
                   fromObjects:(nullable NSArray *)fromObjects
                     toObjects:(nullable NSArray *)toObjects
                    diffResult:(nonnull IGListIndexSetResult *)diffResult
                       updates:(nonnull IGListBatchUpdateData *)updates;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, collectionView: UICollectionView, willCrashWith exception: NSException, from fromObjects: [Any]?, to toObjects: [Any]?, diffResult: IGListIndexSetResult, updates: ListBatchUpdateData)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    collectionView

    The collection view being updated.

    exception

    The exception thrown by the collection view.

    fromObjects

    The items transitioned from in the diff, if any.

    toObjects

    The items transitioned to in the diff, if any.

    diffResult

    The diff result that were computed from fromObjects and toObjects.

    updates

    The batch updates that were applied to the collection view.

  • Notifies the delegate that the updater finished without performing any batch updates or reloads

    Declaration

    Objective-C

    - (void)listAdapterUpdater:(nonnull IGListAdapterUpdater *)listAdapterUpdater
        didFinishWithoutUpdatesWithCollectionView:
            (nullable UICollectionView *)collectionView;

    Swift

    func listAdapterUpdater(_ listAdapterUpdater: IGListAdapterUpdater, didFinishWithoutUpdatesWith collectionView: UICollectionView?)

    Parameters

    listAdapterUpdater

    The adapter updater owning the transition.

    collectionView

    The collection view that reloaded.