diff --git a/README.md b/README.md index f565391..16db304 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

Swift 2 compatible Platform iOS -CocoaPods compatible +CocoaPods compatible License: MIT

diff --git a/Tablet.podspec b/Tablet.podspec index 1dd195d..7cc2a08 100644 --- a/Tablet.podspec +++ b/Tablet.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Tablet' - s.version = '0.2.0' + s.version = '0.2.1' s.homepage = 'https://github.com/maxsokolov/tablet' s.summary = 'Powerful type-safe tool for UITableView. Swift 2.0 is required.' diff --git a/Tablet/TableDirector.swift b/Tablet/TableDirector.swift index cbe110c..a88b27a 100644 --- a/Tablet/TableDirector.swift +++ b/Tablet/TableDirector.swift @@ -94,6 +94,11 @@ public extension TableDirector { let builder = builderAtIndexPath(indexPath) let cell = tableView.dequeueReusableCellWithIdentifier(builder.0.reusableIdentifier, forIndexPath: indexPath) + + if cell.frame.size.width != tableView.frame.size.width { + cell.frame = CGRectMake(0, 0, tableView.frame.size.width, cell.frame.size.height) + cell.layoutIfNeeded() + } builder.0.invokeAction(.configure, cell: cell, indexPath: indexPath, itemIndex: builder.1, userInfo: nil) @@ -192,6 +197,10 @@ public extension TableDirector { sections.forEach { $0.willMoveToDirector(tableView) } self.sections.appendContentsOf(sections) } + + public func clearSections() { + sections.removeAll() + } } public func +=(left: TableDirector, right: RowBuilder) { diff --git a/Tablet/TableRowBuilder.swift b/Tablet/TableRowBuilder.swift index 54c9853..8579f68 100644 --- a/Tablet/TableRowBuilder.swift +++ b/Tablet/TableRowBuilder.swift @@ -161,4 +161,14 @@ public extension TableRowBuilder { items.removeAll() } +} + +public func +=(left: TableRowBuilder, right: I) { + + left.appendItems([right]) +} + +public func +=(left: TableRowBuilder, right: [I]) { + + left.appendItems(right) } \ No newline at end of file diff --git a/Tablet/TableSectionBuilder.swift b/Tablet/TableSectionBuilder.swift index 55dfb11..5912ff0 100644 --- a/Tablet/TableSectionBuilder.swift +++ b/Tablet/TableSectionBuilder.swift @@ -102,4 +102,14 @@ public extension TableSectionBuilder { if let tableView = tableView { rowBuilders.forEach { $0.registerCell(inTableView: tableView) } } builders.appendContentsOf(rowBuilders) } +} + +public func +=(left: TableSectionBuilder, right: RowBuilder) { + + left.appendRowBuilder(right) +} + +public func +=(left: TableSectionBuilder, right: [RowBuilder]) { + + left.appendRowBuilders(right) } \ 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 index 1faa2df..0cc2ecd 100644 Binary files a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate and b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/max.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TabletDemo/TabletDemo/ViewController.swift b/TabletDemo/TabletDemo/ViewController.swift index 5260cd0..1c20338 100644 --- a/TabletDemo/TabletDemo/ViewController.swift +++ b/TabletDemo/TabletDemo/ViewController.swift @@ -31,6 +31,7 @@ class ViewController: UIViewController { print("end display: \(data.indexPath)") } + let configurableRowBuilder = TableConfigurableRowBuilder(items: ["5", "6", "7", "8"], estimatedRowHeight: 300) .action(.click) { data -> Void in