added: canMoveTo
This commit is contained in:
parent
cc02531b27
commit
21aab6256f
|
|
@ -307,6 +307,14 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
|
|||
return UITableViewCellEditingStyle.none
|
||||
}
|
||||
|
||||
public func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
public func tableView(_ tableView: UITableView, targetIndexPathForMoveFromRowAt sourceIndexPath: IndexPath, toProposedIndexPath proposedDestinationIndexPath: IndexPath) -> IndexPath {
|
||||
return invoke(action: .canMoveTo, cell: tableView.cellForRow(at: sourceIndexPath), indexPath: sourceIndexPath, userInfo: [TableKitUserInfoKeys.CellCanMoveProposedIndexPath: proposedDestinationIndexPath]) as? IndexPath ?? proposedDestinationIndexPath
|
||||
}
|
||||
|
||||
open func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
|
||||
if editingStyle == .delete {
|
||||
invoke(action: .clickDelete, cell: tableView.cellForRow(at: indexPath), indexPath: indexPath)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ struct TableKitNotifications {
|
|||
|
||||
public struct TableKitUserInfoKeys {
|
||||
public static let CellMoveDestinationIndexPath = "TableKitCellMoveDestinationIndexPath"
|
||||
public static let CellCanMoveProposedIndexPath = "CellCanMoveProposedIndexPath"
|
||||
}
|
||||
|
||||
public protocol RowConfigurable {
|
||||
|
|
@ -76,6 +77,7 @@ public enum TableRowActionType {
|
|||
case configure
|
||||
case canDelete
|
||||
case canMove
|
||||
case canMoveTo
|
||||
case move
|
||||
case custom(String)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue