diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index b05cada..a86b500 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -48,6 +48,36 @@ public protocol Row: RowConfigurable, RowActionable, RowHashable { var defaultHeight: CGFloat? { get } } + + + + + +public protocol RowAction { + + func invokeActionOn(cell: CellType, item: CellType.T, path: IndexPath) -> Any? where CellType: UITableViewCell +} + + + + +open class TableRowActionX: RowAction where ActionCellType: UITableViewCell { + + var handler: ((TableRowActionData) -> Void)? + + public func invokeActionOn(cell: CellType, item: CellType.T, path: IndexPath) -> Any? where CellType: UITableViewCell { + + guard let item = item as? ActionCellType.T else { return nil } + + let x = TableRowActionData(item: item, cell: cell as? ActionCellType, path: path, userInfo: nil) + + handler?(x) + + return nil + } +} + + open class TableRow: Row where CellType: UITableViewCell { open let item: CellType.T