support any actions on row
This commit is contained in:
parent
f794dea7ee
commit
135bc22804
|
|
@ -30,6 +30,7 @@ public protocol RowActionable {
|
|||
var editingActions: [UITableViewRowAction]? { get }
|
||||
func isEditingAllowed(forIndexPath indexPath: IndexPath) -> Bool
|
||||
|
||||
func on(anyAction action: RowAction) -> Self
|
||||
func invoke(action: TableRowActionType, cell: UITableViewCell?, path: IndexPath, userInfo: [AnyHashable: Any]?) -> Any?
|
||||
func has(action: TableRowActionType) -> Bool
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,13 +84,8 @@ open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableView
|
|||
|
||||
@discardableResult
|
||||
open func on(_ action: TableRowAction<CellType>) -> Self {
|
||||
|
||||
if actions[action.type.key] == nil {
|
||||
actions[action.type.key] = [RowAction]()
|
||||
}
|
||||
actions[action.type.key]?.append(action)
|
||||
|
||||
return self
|
||||
return on(anyAction: action)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
|
|
@ -99,6 +94,17 @@ open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableView
|
|||
return on(TableRowAction<CellType>(type, handler: handler))
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
open func on(anyAction action: RowAction) -> Self {
|
||||
|
||||
if actions[action.type.key] == nil {
|
||||
actions[action.type.key] = [RowAction]()
|
||||
}
|
||||
actions[action.type.key]?.append(action)
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
open func removeAllActions() {
|
||||
|
||||
actions.removeAll()
|
||||
|
|
|
|||
Loading…
Reference in New Issue