diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index 41798dd..ea20fd1 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -273,6 +273,10 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate { invoke(action: .clickDelete, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) } } + + open func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { + invoke(action: .move, cell: tableView.cellForRow(at: sourceIndexPath), indexPath: sourceIndexPath, userInfo: [TableKitUserInfoKeys.CellMoveDestinationIndexPath: destinationIndexPath]) + } } // MARK: - Sections manipulation diff --git a/Sources/TableKit.swift b/Sources/TableKit.swift index 6b8b11c..96a2e48 100644 --- a/Sources/TableKit.swift +++ b/Sources/TableKit.swift @@ -24,6 +24,10 @@ struct TableKitNotifications { static let CellAction = "TableKitNotificationsCellAction" } +public struct TableKitUserInfoKeys { + public static let CellMoveDestinationIndexPath = "TableKitCellMoveDestinationIndexPath" +} + public protocol RowConfigurable { func configure(_ cell: UITableViewCell) @@ -65,6 +69,7 @@ public enum TableRowActionType { case height case canEdit case configure + case move case custom(String) var key: String {