add removeAllActions method
This commit is contained in:
parent
0af6956d62
commit
c040613654
|
|
@ -34,11 +34,16 @@ class MainController: UIViewController {
|
|||
break
|
||||
}
|
||||
}
|
||||
|
||||
let printClickAction = TableRowAction<ConfigurableTableViewCell>(.click) { (data) in
|
||||
|
||||
print("click", data.indexPath)
|
||||
}
|
||||
|
||||
let rows = [
|
||||
|
||||
TableRow<ConfigurableTableViewCell>(item: "Autolayout cells", actions: [clickAction]),
|
||||
TableRow<ConfigurableTableViewCell>(item: "Nib cells", actions: [clickAction])
|
||||
TableRow<ConfigurableTableViewCell>(item: "Autolayout cells", actions: [clickAction, printClickAction]),
|
||||
TableRow<ConfigurableTableViewCell>(item: "Nib cells", actions: [clickAction, printClickAction])
|
||||
]
|
||||
|
||||
// automatically creates a section, also could be used like tableDirector.append(rows: rows)
|
||||
|
|
|
|||
|
|
@ -97,6 +97,11 @@ open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableView
|
|||
return on(TableRowAction<CellType>(type, handler: handler))
|
||||
}
|
||||
|
||||
func removeAllActions() {
|
||||
|
||||
actions.removeAll()
|
||||
}
|
||||
|
||||
// MARK: - deprecated actions -
|
||||
|
||||
@available(*, deprecated, message: "Use 'on' method instead")
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ class TabletTests: XCTestCase {
|
|||
let expectation = self.expectation(description: "cell action")
|
||||
|
||||
let row = TableRow<TestTableViewCell>(item: TestData(title: "title"))
|
||||
.action(TableRowAction(.custom(TestTableViewCellOptions.CellAction)) { (data) in
|
||||
.on(TableRowAction(.custom(TestTableViewCellOptions.CellAction)) { (data) in
|
||||
|
||||
XCTAssertNotNil(data.cell, "Action data should have a cell")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue