CollectionViewUpdater

open class CollectionViewUpdater : StorageUpdating

CollectionViewUpdater is responsible for updating UICollectionView, when it receives storage updates.

  • closure to be executed before content is updated

    Declaration

    Swift

    open var willUpdateContent: ((StorageUpdate?) -> Void)?
  • closure to be executed after content is updated

    Declaration

    Swift

    open var didUpdateContent: ((StorageUpdate?) -> Void)?
  • Closure to be executed, when reloading an item.

    Declaration

    Swift

    open var reloadItemClosure: ((IndexPath, Any) -> Void)?
  • When this property is true, move events will be animated as delete event and insert event.

    Declaration

    Swift

    open var animateMoveAsDeleteAndInsert: Bool
  • Boolean property, that indicates whether batch updates are completed.

    Note

    this can be useful if you are deciding whether to run another batch of animations - insertion, deletions etc. UICollectionView is not very tolerant to multiple performBatchUpdates, executed at once.

    Declaration

    Swift

    open var batchUpdatesInProgress: Bool
  • If turned on, animates changes off screen, otherwise calls collectionView.reloadData when update come offscreen. To verify if tableView is onscreen, CollectionViewUpdater compares collectionView.window to nil. Defaults to true.

    Declaration

    Swift

    open var animateChangesOffScreen: Bool
  • Creates updater.

    Declaration

    Swift

    public init(collectionView: UICollectionView,
                reloadItem: ((IndexPath, Any) -> Void)? = nil,
                animateMoveAsDeleteAndInsert: Bool = false)
  • Updates UICollectionView with received update. This method applies object and section changes in performBatchUpdates method.

    Declaration

    Swift

    open func storageDidPerformUpdate(_ update: StorageUpdate)
  • Call this method, if you want UICollectionView to be reloaded, and beforeContentUpdate: and afterContentUpdate: closures to be called.

    Declaration

    Swift

    open func storageNeedsReloading()