UICollectionViewUpdater
open class UICollectionViewUpdater<Adapter> : Updater where Adapter : UICollectionViewAdapter
An updater for managing diffing updates to render data to the UICollectionView
.
-
A Bool value indicating whether that enable diffing animation. Default is true.
Declaration
Swift
open var isAnimationEnabled: Bool
-
A Bool value indicating whether that enable diffing animation while target is scrolling. Default is false.
Declaration
Swift
open var isAnimationEnabledWhileScrolling: Bool
-
A Bool value indicating whether that to always render visible components after diffing updated. Default is true.
Declaration
Swift
open var alwaysRenderVisibleComponents: Bool
-
A Bool value indicating whether that to reset content offset after updated if not scrolling. Default is true.
Declaration
Swift
open var keepsContentOffset: Bool
-
Max number of changes that can be animated for diffing updates. Default is 300.
Declaration
Swift
open var animatableChangeCount: Int
-
A completion handler to be called after each updates.
Declaration
Swift
open var completion: (() -> Void)?
-
Create a new updater.
Declaration
Swift
public init()
-
Set the
delegate
anddataSource
of given collection view, then reload data and invalidate layout.Declaration
Swift
open func prepare(target: UICollectionView, adapter: Adapter)
Parameters
target
A target to be prepared.
adapter
An adapter to be set to
delegate
anddataSource
. -
Perform updates to render given data to the target. The completion is expected to be called after all updates and the its animations.
Declaration
Parameters
target
A target instance to be updated to render given data.
adapter
An adapter holding currently rendered data.
data
A collection of sections to be rendered next.
-
Perform diffing updates to render given data to the target.
Declaration
Swift
open func performDifferentialUpdates(target: UICollectionView, adapter: Adapter, stagedChangeset: StagedDataChangeset)
Parameters
target
A target instance to be updated to render given data.
adapter
An adapter holding currently rendered data.
stagedChangeset
A staged set of changes of current data and next data.
-
Renders components displayed in visible area again.
Declaration
Swift
open func renderVisibleComponents(in target: UICollectionView, adapter: Adapter)
Parameters
target
A target instance to render components.
adapter
An adapter holding currently rendered data.