From f794dea7eed6ce7204ea975f27b9455677fe6875 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Sun, 16 Oct 2016 13:06:47 +0300 Subject: [PATCH] bump readme --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d08f63e..eedfd29 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ let action = TableRowAction(.click) { (options) in // options.cell - StringTableViewCell? // options.item - String // options.indexPath - IndexPath + // options.userInfo - [AnyHashable: Any]? } let row = TableRow(item: "some", actions: [action]) @@ -130,6 +131,24 @@ let myAction = TableRowAction(.custom(MyActions.ButtonClicked)) } ``` +## Multiple actions with same type + +It's also possible to use multiple actions with same type: +```swift +let click1 = TableRowAction(.click) { (options) in } +click1.id = "click1" // optional + +let click2 = TableRowAction(.click) { (options) in } +click2.id = "click2" // optional + +let row = TableRow(item: "some", actions: [click1, click2]) +``` +Could be useful in case if you want to separate your logic somehow. Actions will be invoked in order which they were attached. +> If you define multiple actions with same type which also return a value, only last return value will be used for table view. +You could also remove any action by id: +```swift +row.removeAction(forActionId: "action_id") +``` # Advanced @@ -149,7 +168,7 @@ It's enough for most cases. But you may be not happy with this. So you could use ```swift tableDirector.shouldUsePrototypeCellHeightCalculation = true ``` -It does all dirty work with prototypes for you [behind the scene](Sources/HeightStrategy.swift), so you don't have to worry about anything except of your cell configuration: +It does all dirty work with prototypes for you [behind the scene](Sources/TablePrototypeCellHeightCalculator.swift), so you don't have to worry about anything except of your cell configuration: ```swift class ImageTableViewCell: UITableViewCell, ConfigurableCell {