diff --git a/Tablet/TableDirector.swift b/Tablet/TableDirector.swift index 28379b1..9856c1c 100644 --- a/Tablet/TableDirector.swift +++ b/Tablet/TableDirector.swift @@ -62,7 +62,7 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate public func invokeAction(action: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath) -> AnyObject? { let builder = builderAtIndexPath(indexPath) - return builder.0.invokeAction(action, cell: cell, indexPath: indexPath, itemIndex: builder.1) + return builder.0.invokeAction(action, cell: cell, indexPath: indexPath, itemIndex: builder.1, userInfo: nil) } internal func didReceiveAction(notification: NSNotification) { @@ -70,7 +70,7 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate if let action = notification.object as? Action, indexPath = tableView.indexPathForCell(action.cell) { let builder = builderAtIndexPath(indexPath) - builder.0.invokeAction(.custom(action.key), cell: action.cell, indexPath: indexPath, itemIndex: builder.1) + builder.0.invokeAction(.custom(action.key), cell: action.cell, indexPath: indexPath, itemIndex: builder.1, userInfo: action.userInfo) } } @@ -80,7 +80,7 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate if let _ = bundle.pathForResource("cell name", ofType: "nib") { // existing cell - tableView.registerNib(UINib(nibName: "", bundle: bundle), forCellReuseIdentifier: "") + tableView.registerNib(UINib(nibName: "cell", bundle: bundle), forCellReuseIdentifier: "cell id") } else { @@ -122,7 +122,7 @@ public extension TableDirector { let cell = tableView.dequeueReusableCellWithIdentifier(builder.0.reusableIdentifier, forIndexPath: indexPath) - builder.0.invokeAction(.configure, cell: cell, indexPath: indexPath, itemIndex: builder.1) + builder.0.invokeAction(.configure, cell: cell, indexPath: indexPath, itemIndex: builder.1, userInfo: nil) return cell } diff --git a/Tablet/TableRowBuilder.swift b/Tablet/TableRowBuilder.swift index 9d1b418..d980ac1 100644 --- a/Tablet/TableRowBuilder.swift +++ b/Tablet/TableRowBuilder.swift @@ -95,7 +95,7 @@ public class TableRowBuilder : RowBuilder { // MARK: Triggers - public func invokeAction(actionType: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int) -> AnyObject? { + public func invokeAction(actionType: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int, userInfo: [NSObject: AnyObject]? = nil) -> AnyObject? { if let action = actions[actionType.key] { return action.invoke(ActionData(cell: cell as? C, indexPath: indexPath, item: items[itemIndex], itemIndex: itemIndex)) @@ -117,7 +117,7 @@ public class TableConfigurableRowBuilder AnyObject? { + public override func invokeAction(actionType: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int, userInfo: [NSObject: AnyObject]? = nil) -> AnyObject? { switch actionType { case .configure: diff --git a/Tablet/TableSectionBuilder.swift b/Tablet/TableSectionBuilder.swift index b106bb8..f74bdd3 100644 --- a/Tablet/TableSectionBuilder.swift +++ b/Tablet/TableSectionBuilder.swift @@ -50,7 +50,7 @@ public class TableSectionBuilder { self.footerTitle = footerTitle if let initialRows = rowBuilders { - self.builders.appendContentsOf(initialRows) + builders.appendContentsOf(initialRows) } } @@ -84,4 +84,9 @@ public extension TableSectionBuilder { builders.removeAll() } + + public func appendRowBuilder(rowBuilder: RowBuilder) { + + builders.append(rowBuilder) + } } \ No newline at end of file diff --git a/Tablet/Tablet.swift b/Tablet/Tablet.swift index 4b3db85..12158ed 100644 --- a/Tablet/Tablet.swift +++ b/Tablet/Tablet.swift @@ -122,5 +122,5 @@ public protocol RowBuilder { var reusableIdentifier: String { get } var estimatedRowHeight: CGFloat { get } - func invokeAction(actionType: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int) -> AnyObject? + func invokeAction(actionType: ActionType, cell: UITableViewCell?, indexPath: NSIndexPath, itemIndex: Int, userInfo: [NSObject: AnyObject]?) -> AnyObject? } \ No newline at end of file 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 128e146..5dccf4a 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 diff --git a/TabletDemo/TabletDemo/Base.lproj/Main.storyboard b/TabletDemo/TabletDemo/Base.lproj/Main.storyboard index 7c1d36f..65ef436 100644 --- a/TabletDemo/TabletDemo/Base.lproj/Main.storyboard +++ b/TabletDemo/TabletDemo/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -23,14 +23,14 @@ - + - + - + - +