diff --git a/Tablet.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate b/Tablet.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate index b016cad..e78d368 100644 Binary files a/Tablet.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate and b/Tablet.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TabletDemo/Classes/Presentation/Controllers/MainController.swift b/TabletDemo/Classes/Presentation/Controllers/MainController.swift index f527e9b..5a0a5bd 100644 --- a/TabletDemo/Classes/Presentation/Controllers/MainController.swift +++ b/TabletDemo/Classes/Presentation/Controllers/MainController.swift @@ -14,6 +14,43 @@ class TableUpdateTask { } +protocol CellItemable { + + func configure(cell: UITableViewCell) +} + +class CellItem: CellItemable { + + let item: DataType + + init(item: DataType) { + self.item = item + } + + func configure(cell: UITableViewCell) { + (cell as? CellType)?.configure(item) + } +} + + +class BUILDER { + + var cellItems = [CellItemable]() + + init(cellItems: [CellItemable]) { + self.cellItems = cellItems + + } + + func configure(cell: UITableViewCell, itemIndex: Int) { + + let cellItem = cellItems[itemIndex] + + cellItem.configure(cell) + } +} + + class MainController: UIViewController { @IBOutlet weak var tableView: UITableView! { @@ -33,7 +70,22 @@ class MainController: UIViewController { let rows2 = TableRowBuilder(items: ["1", "1", "1", "1"]) + + + + let cellItem = CellItem(item: "1") + + let cellItem2 = CellItem(item: "1") + + let cellItem3 = CellItem(item: "1") + + + + + let b = BUILDER(cellItems: [cellItem, cellItem2, cellItem3]) + + rowBuilder .addAction(TableRowAction(type: .Click) { (data) in