ArrayDataProviderModifier

public final class ArrayDataProviderModifier<Element> : DataModifying

Wrapps an ArrayDataProvider and handles changes to manipulate the content of the provider.

Seealso

DataModifying
  • Flag if items can be moved by the data source.

    Declaration

    Swift

    public var canMoveItems: Bool
  • Flag if items can be edited by the data source.

    Declaration

    Swift

    public var canEditItems: Bool
  • Creates an ArrayDataProvider instance.

    Declaration

    Swift

    public init(dataProvider: ArrayDataProvider<Element>, canMoveItems: Bool = false, canEditItems: Bool = false, createElement: (() -> Element)? = nil)

    Parameters

    dataProvider

    the data provider which should be modifiable

    canMoveItems

    Flag if items can be moved by the data source.

    canEditItems

    Flag if items can be edited by the data source.

  • Checks whether item at an indexPath can be moved

    Declaration

    Swift

    public func canMoveItem(at indexPath: IndexPath) -> Bool

    Parameters

    indexPath

    the indexPath to check for if it can be moved

    Return Value

    if the item can be moved

  • Moves item from sourceIndexPath to destinationIndexPath

    Declaration

    Swift

    public func moveItemAt(sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath, updateView: Bool = true)

    Parameters

    sourceIndexPath

    Source’s IndexPath

    destinationIndexPath

    Destination’s IndexPath

    updateView

    determines if the view should be updated. Pass false if someone else take care of updating the change into the view

  • Checks wethere item at an indexPath can be edited

    Declaration

    Swift

    public func canEditItem(at indexPath: IndexPath) -> Bool

    Parameters

    indexPath

    the indexPath to check for if it can be edited

    Return Value

    if the item can be edited

  • Deleted item at a given indexPath

    Declaration

    Swift

    public func deleteItem(at indexPath: IndexPath)

    Parameters

    indexPath

    the indexPath to delete

  • Inserts an element at given indexPath

    Declaration

    Swift

    public func insertItem(at indexPath: IndexPath)