TableViewUpdater

open class TableViewUpdater : StorageUpdating

TableViewUpdater is responsible for updating UITableView, 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)?
  • Insert section animation. Default - .none.

    Declaration

    Swift

    open var insertSectionAnimation: UITableView.RowAnimation
  • Delete section animation. Default - .automatic

    Declaration

    Swift

    open var deleteSectionAnimation: UITableView.RowAnimation
  • Reload section animation. Default - .automatic.

    Declaration

    Swift

    open var reloadSectionAnimation: UITableView.RowAnimation
  • Insert row animation. Default - .automatic.

    Declaration

    Swift

    open var insertRowAnimation: UITableView.RowAnimation
  • Delete row animation. Default - .automatic.

    Declaration

    Swift

    open var deleteRowAnimation: UITableView.RowAnimation
  • Reload row animation. Default - .automatic.

    Declaration

    Swift

    open var reloadRowAnimation: UITableView.RowAnimation
  • Closure to be executed, when reloading a row.

    If this property is not nil, then reloadRowAnimation property is ignored.

    Declaration

    Swift

    open var reloadRowClosure: ((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
  • Undocumented

    Declaration

    Swift

    open var usesLegacyTableViewUpdateMethods: Bool
  • If turned on, animates changes off screen, otherwise calls tableView.reloadData when update come offscreen. To verify if tableView is onscreen, TableViewUpdater compares tableView.window to nil. Defaults to true.

    Declaration

    Swift

    open var animateChangesOffScreen: Bool
  • Creates updater with tableView.

    Declaration

    Swift

    public init(tableView: UITableView, reloadRow: ((IndexPath, Any) -> Void)? = nil, animateMoveAsDeleteAndInsert: Bool = false)
  • Updates UITableView with received update. This method applies object and section changes in performBatchUpdates method or tableView.beginUpdates - tableView.endUpdates block. To enable iOS 11 performBatchUpdates method usage, set usesLegacyTableViewUpdateMethods to false. It is also highly recommended to turn on MemoryStorage.defersDatasourceUpdates flag on to prevent multiple issues that can happen if you try to use iOS 11 performBatchUpdates API.

    Declaration

    Swift

    open func storageDidPerformUpdate(_ update: StorageUpdate)
  • Call this method, if you want UITableView to be reloaded, and beforeContentUpdate: and afterContentUpdate: closures to be called.

    Declaration

    Swift

    open func storageNeedsReloading()