Implement tableView:canMoveRowAt:indexPath method

This commit is contained in:
Alexander Desyatov 2018-04-06 20:22:29 +03:00
parent f05511cfba
commit 74af45f3cd
2 changed files with 5 additions and 0 deletions

View File

@ -307,6 +307,10 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
}
}
open func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
return invoke(action: .canMove, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath) as? Bool ?? true
}
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])
}

View File

@ -74,6 +74,7 @@ public enum TableRowActionType {
case height
case canEdit
case configure
case canMove
case move
case custom(String)