Added support to move rows

This commit is contained in:
Matias Rojas 2018-03-13 00:16:17 +03:00
parent 9fff8c861c
commit 709f739ab6
2 changed files with 6 additions and 0 deletions

View File

@ -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: [TableKitNotifications.CellMoveDestinationIndexPath: destinationIndexPath])
}
}
// MARK: - Sections manipulation

View File

@ -22,6 +22,7 @@ import UIKit
struct TableKitNotifications {
static let CellAction = "TableKitNotificationsCellAction"
static let CellMoveDestinationIndexPath = "TableKitCellMoveDestinationIndexPath"
}
public protocol RowConfigurable {
@ -65,6 +66,7 @@ public enum TableRowActionType {
case height
case canEdit
case configure
case move
case custom(String)
var key: String {