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
  • If turned on, animates changes off screen, otherwise calls collectionView.reloadData when update come offscreen. To verify if collectionView 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()