diff --git a/Tablet/TableDirector.swift b/Tablet/TableDirector.swift index 6c1eda9..2e8ed72 100644 --- a/Tablet/TableDirector.swift +++ b/Tablet/TableDirector.swift @@ -165,12 +165,12 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate } public func tableView(tableView: UITableView, shouldHighlightRowAtIndexPath indexPath: NSIndexPath) -> Bool { - + return triggerAction(.shouldHighlight, cell: tableView.cellForRowAtIndexPath(indexPath), indexPath: indexPath) as? Bool ?? true } public func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { - + return triggerAction(.height, cell: nil, indexPath: indexPath) as? CGFloat ?? tableView.rowHeight } } \ No newline at end of file diff --git a/Tablet/TableRowBuilder.swift b/Tablet/TableRowBuilder.swift index 66a2924..a7f2044 100644 --- a/Tablet/TableRowBuilder.swift +++ b/Tablet/TableRowBuilder.swift @@ -82,21 +82,21 @@ public class TableRowBuilder : RowBuilder { // MARK: Chaining actions - public func action(key: String, action: (data: ActionData) -> Void) -> Self { + public func action(key: String, closure: (data: ActionData) -> Void) -> Self { - actions[key] = .actionBlock(action) + actions[key] = .actionBlock(closure) return self } - public func action(actionType: ActionType, action: (data: ActionData) -> Void) -> Self { + public func action(actionType: ActionType, closure: (data: ActionData) -> Void) -> Self { - actions[actionType.key] = .actionBlock(action) + actions[actionType.key] = .actionBlock(closure) return self } - public func action(actionType: ActionType, action: (data: ActionData) -> AnyObject) -> Self { + public func action(actionType: ActionType, closure: (data: ActionData) -> AnyObject) -> Self { - actions[actionType.key] = .actionReturnBlock(action) + actions[actionType.key] = .actionReturnBlock(closure) return self } @@ -126,8 +126,11 @@ public class TableConfigurableRowBuilder AnyObject? { - (cell as? C)?.configureWithItem(items[itemIndex]) - + switch actionType { + case .configure: + (cell as? C)?.configureWithItem(items[itemIndex]) + default: break + } return super.triggerAction(actionType, cell: cell, indexPath: indexPath, itemIndex: itemIndex) } } diff --git a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate index 701e1e2..3ddca07 100644 Binary files a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate and b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate differ