Merge pull request #3 from maxsokolov/develop

0.2.1
This commit is contained in:
Max Sokolov 2016-01-18 11:09:40 +03:00
commit a403def467
7 changed files with 32 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<p align="left">
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift2-compatible-4BC51D.svg?style=flat" alt="Swift 2 compatible" /></a>
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
<a href="https://cocoapods.org/pods/tablet"><img src="https://img.shields.io/badge/pod-0.2.0-blue.svg" alt="CocoaPods compatible" /></a>
<a href="https://cocoapods.org/pods/tablet"><img src="https://img.shields.io/badge/pod-0.2.1-blue.svg" alt="CocoaPods compatible" /></a>
<a href="https://raw.githubusercontent.com/maxsokolov/tablet/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
</p>

View File

@ -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.'

View File

@ -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) {

View File

@ -161,4 +161,14 @@ public extension TableRowBuilder {
items.removeAll()
}
}
public func +=<I, C>(left: TableRowBuilder<I, C>, right: I) {
left.appendItems([right])
}
public func +=<I, C>(left: TableRowBuilder<I, C>, right: [I]) {
left.appendItems(right)
}

View File

@ -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)
}

View File

@ -31,6 +31,7 @@ class ViewController: UIViewController {
print("end display: \(data.indexPath)")
}
let configurableRowBuilder = TableConfigurableRowBuilder<String, ConfigurableTableViewCell>(items: ["5", "6", "7", "8"], estimatedRowHeight: 300)
.action(.click) { data -> Void in