diff --git a/Tablet/Tablet.swift b/Tablet/Tablet.swift index cb9b68b..f6cd97f 100644 --- a/Tablet/Tablet.swift +++ b/Tablet/Tablet.swift @@ -33,6 +33,9 @@ public enum ActionType : String { case deselect = "_deselect" case configure = "_configure" case willDisplay = "_willDisplay" + case shouldHighlight = "_shouldHighlight" + + } public struct ActionData { @@ -99,6 +102,7 @@ public protocol ReusableRowBuilder { public class TableRowBuilder : ReusableRowBuilder { public typealias TableRowBuilderActionBlock = (data: ActionData) -> Void + public typealias TableRowBuilderReturnValueActionBlock = (data: ActionData) -> AnyObject private var actions = Dictionary() private var items = [I]() @@ -149,6 +153,18 @@ public class TableRowBuilder : ReusableRowBuilder return self } + public func action(key: ActionType, action: TableRowBuilderReturnValueActionBlock) -> Self { + + + return self + } + + public func actionWithReturnValue(key: ActionType, action: (ActionData) -> Bool) -> Self { + + + return self + } + // MARK: Triggers public func triggerAction(key: String, cell: UITableViewCell, indexPath: NSIndexPath, itemIndex: Int) -> Bool { @@ -383,4 +399,9 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate triggerAction(.willDisplay, cell: cell, indexPath: indexPath) } + + public func tableView(tableView: UITableView, shouldHighlightRowAtIndexPath indexPath: NSIndexPath) -> Bool { + + return false + } } \ No newline at end of file diff --git a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..463604b Binary files /dev/null and b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/TabletDemo.xcscheme b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/TabletDemo.xcscheme new file mode 100644 index 0000000..6db4123 --- /dev/null +++ b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/TabletDemo.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..c382e1a --- /dev/null +++ b/TabletDemo/TabletDemo.xcodeproj/xcuserdata/max.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + TabletDemo.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + DAB7EB261BEF787300D2AD5E + + primary + + + + + diff --git a/TabletDemo/TabletDemo/ViewController.swift b/TabletDemo/TabletDemo/ViewController.swift index 8dd2ca5..ca9f5e8 100644 --- a/TabletDemo/TabletDemo/ViewController.swift +++ b/TabletDemo/TabletDemo/ViewController.swift @@ -30,9 +30,13 @@ class ViewController: UIViewController { print("custom action indexPath: \(data.indexPath), item: \(data.item)") } .action(.click) { data in - + print("custom action indexPath: \(data.indexPath), item: \(data.item)") } + .action(.shouldHighlight) { _ in + + return false + } let sectionBuilder = TableSectionBuilder(headerTitle: "Tablet", footerTitle: "Deal with table view like a boss.", rowBuilders: [rowBuilder, configurableRowBuilder])