SingleSectionCollectionViewDiffCalculator

public final class SingleSectionCollectionViewDiffCalculator<Value: Equatable>

If your collection view only has a single section, or you only want to power a single section of it with Dwifft, use a SingleSectionCollectionViewDiffCalculator. Note that this approach is not highly recommended, and you should do so only if it really doesn’t make sense to just power your whole view with a CollectionViewDiffCalculator. You’ll be less likely to mess up the index math :P

  • The collection view to be managed

    Declaration

    Swift

    public weak var collectionView: UICollectionView?
  • All insertion/deletion calls will be made for items at this section.

    Declaration

    Swift

    public let sectionIndex: Int
  • Set this variable to automatically trigger the correct item insertion/deletions on your collection view.

    Declaration

    Swift

    public var items : [Value]
  • Initializes a new diff calculator.

    Declaration

    Swift

    public init(collectionView: UICollectionView?, initialItems: [Value] = [], sectionIndex: Int = 0)

    Parameters

    tableView

    the table view to be managed

    initialItems

    optional - if specified, these will be the initial contents of the diff calculator.

    sectionIndex

    optional - all insertion/deletion calls will be made on this index.