readme updated

This commit is contained in:
Max Sokolov 2015-11-15 19:29:30 +03:00
parent e25b7d759e
commit a268a726bb
4 changed files with 8 additions and 7 deletions

View File

@ -7,7 +7,7 @@
<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>
Tablet is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swift environment. Tablet's goal is to provide an easiest way to create complex table views. With Tablet you don't have to write a messy code of switch or if statements when you deal with bunch of different cells in different sections.
Tablet is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swift environment. Tablet's goal is to provide an easiest way to create complex table views. With Tablet you don't have to write a messy code of `switch` or `if` statements when you deal with bunch of different cells in different sections.
That's almost all you need in your controller to build a bunch of cells in a section:
```swift
@ -89,7 +89,7 @@ Once you've implemented the protocol, simply use the `TableConfigurableRowBuilde
```swift
import Tablet
let rowBuilder = TableConfigurableRowBuilder<User, MyTableViewCell>()
let rowBuilder = TableConfigurableRowBuilder<User, MyTableViewCell>(estimatedRowHeight: 42)
rowBuilder.appendItems(users)
director = TableDirector(tableView: tableView)
@ -159,17 +159,18 @@ extension TableDirector {
public func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
performAction(.custom(kTableDirectordidEndDisplayingCell), cell: cell, indexPath: indexPath)
performAction(.custom(kTableDirectorDidEndDisplayingCell), cell: cell, indexPath: indexPath)
}
}
```
Catch your action with row builder:
```swift
let rowBuilder = TableConfigurableRowBuilder<User, MyTableViewCell>(items: users)
.action(kTableDirectordidEndDisplayingCell) { data in
let rowBuilder = TableConfigurableRowBuilder<User, MyTableViewCell>(items: users, estimatedRowHeight: 42)
.action(kTableDirectorDidEndDisplayingCell) { data in
}
```
You could also perform an action that returns a value.
## License

View File

@ -3,7 +3,7 @@ Pod::Spec.new do |s|
s.version = '0.1.0'
s.homepage = 'https://github.com/maxsokolov/tablet'
s.summary = 'Tablet is a super lightweight yet powerful Swift library that handles a complexity of UITableView's datasource and delegate.'
s.summary = 'Powerful type-safe tool for UITableView. Swift 2.0 is required.'
s.author = { 'Max Sokolov' => 'i@maxsokolov.net' }
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -50,7 +50,7 @@ class ViewController: UIViewController {
}
.action(.configure) { (data) -> Void in
data.cell!.contentLabel.text = "With iOS 8, Apple has internalized much of the work that previously had to be implemented by you prior to iOS 8. In order to allow the self-sizing cell mechanism to work, you must first set the rowHeight property on the table view to the constant UITableViewAutomaticDimension. Then, you simply need to enable row height estimation by setting the table view's estimatedRowHeight property to a nonzero value, for example"
data.cell!.contentLabel.text = "Tablet is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swift environment. Tablet's goal is to provide an easiest way to create complex table views. With Tablet you don't have to write a messy code of switch or if statements when you deal with bunch of different cells in different sections."
}
let sectionBuilder = TableSectionBuilder(headerTitle: "Tablet", footerTitle: "Deal with table view like a boss.", rowBuilders: [rowBuilder, configurableRowBuilder])