TableEditingController

public struct TableEditingController<DataSource> where DataSource : DataSourceProtocol

An instance of TableEditingController allows editing a table view via inserting and deleting rows.

Typealiases

  • Asks if a row at the specified index path is editable for the specified table view.

    Declaration

    Swift

    public typealias CanEditRowConfig = (DataSource.Item?, UITableView, IndexPath) -> Bool

    Parameters

    item

    The item at indexPath.

    tableView

    The table view requesting this information.

    indexPath

    The index path of the item.

    Return Value

    true if the specified row is editable, false otherwise.

  • Commits the editing actions for the specified index path.

    Declaration

    Swift

    public typealias CommitEditingConfig = (inout DataSource, UITableView, UITableViewCell.EditingStyle, IndexPath) -> Void

    Parameters

    dataSource

    The dataSource at indexPath.

    tableView

    The table view being edited.

    commit

    The editing style.

    indexPath

    The index path of the item.

  • A closure that determines if a given row is editable.

    Declaration

    Swift

    public let canEditRow: CanEditRowConfig
  • A closure that commits the editing actions for a table view.

    Declaration

    Swift

    public let commitEditing: CommitEditingConfig

Initialization

  • Constructs a new TableEditingController.

    Declaration

    Swift

    public init(canEditRow: @escaping CanEditRowConfig, commitEditing: @escaping CommitEditingConfig)

    Parameters

    canEditRow

    The closure that determines if a given row is editable.

    commitEditing

    The closure that commits the editing actions for a table view.

    Return Value

    A new TableEditingController instance.