bump readme

This commit is contained in:
Max Sokolov 2016-05-15 16:10:38 +03:00
parent 08a56c799c
commit 39d4f8ce4e
1 changed files with 24 additions and 24 deletions

View File

@ -1,12 +1,12 @@
![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/maxsokolov/tablet/assets/logo.png)
#Tablet
#Tablet.swift
<p align="left">
<a href="https://travis-ci.org/maxsokolov/tablet"><img src="https://travis-ci.org/maxsokolov/tablet.svg" alt="Build Status" /></a>
<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>
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift_2.2-compatible-4BC51D.svg?style=flat" alt="Swift 2.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.4.0-blue.svg" alt="CocoaPods compatible" /></a>
<a href="https://cocoapods.org/pods/tablet"><img src="https://img.shields.io/badge/pod-0.5.0-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>
@ -17,16 +17,16 @@ Tablet is a super lightweight yet powerful generic library that handles a comple
- [x] Type-safe cells based on generics
- [x] The easiest way to map your models or view models to cells
- [x] Correctly handles autolayout cells with multiline labels
- [x] Chainable cell actions
- [x] Chainable cell actions (select/deselect etc.)
- [x] Support cells created from code, xib, or storyboard
- [x] Automatic xib/classes registration
- [x] No need to subclass
- [x] Extensibility
- [x] Tests
That's almost all you need in your controller to build a bunch of cells in a section 😘:
That's almost all you need in your controller to build a bunch of cells in a section:
```swift
TableConfigurableRowBuilder<String, MyTableViewCell>(items: ["1", "2", "3", "4", "5"])
let builder = TableRowBuilder<String, MyTableViewCell>(items: ["1", "2", "3", "4", "5"])
```
Tablet respects cells reusability feature and built with performace in mind. See the Usage section to learn more.
@ -59,28 +59,28 @@ $ pod install
### Very basic
You may want to setup a very basic table view, without any custom cells. In that case simply use the `TableRowBuilder`.
You may want to setup a very basic table view, without any custom cells. In that case simply use the `TableBaseRowBuilder`.
```swift
import Tablet
let rowBuilder = TableRowBuilder<User, UITableViewCell>(items: [user1, user2, user3], id: "reusable_id")
.action(.configure) { data -> Void in
let rowBuilder = TableBaseRowBuilder<User, UITableViewCell>(items: [user1, user2, user3], id: "reusable_id")
.action(.configure) { (data) in
data.cell?.textLabel?.text = data.item.username
data.cell?.detailTextLabel?.text = data.item.isActive ? "Active" : "Inactive"
}
let sectionBuilder = TableSectionBuilder(headerTitle: "Users", rows: [rowBuilder])
let sectionBuilder = TableSectionBuilder(headerTitle: "Users", footerTitle: nil, rows: [rowBuilder])
director = TableDirector(tableView: tableView)
director.appendSections(sectionBuilder)
director += sectionBuilder
```
### Type-safe configurable cells
Let's say you want to put your cell configuration logic into cell itself. Say you want to pass your view model (or even model) to your cell.
You could easily do this using the `TableConfigurableRowBuilder`. Your cell should respect the `ConfigurableCell` protocol as you may see in example below:
You could easily do this using the `TableRowBuilder`. Your cell should conforms to `ConfigurableCell` protocol as you may see in example below:
```swift
import Tablet
@ -104,16 +104,16 @@ class MyTableViewCell : UITableViewCell, ConfigurableCell {
}
}
```
Once you've implemented the protocol, simply use the `TableConfigurableRowBuilder` to build cells:
Once you've implemented the protocol, simply use the `TableRowBuilder` to build cells:
```swift
import Tablet
let rowBuilder = TableConfigurableRowBuilder<User, MyTableViewCell>()
rowBuilder.appendItems(users)
let rowBuilder = TableRowBuilder<User, MyTableViewCell>()
rowBuilder += users
director = TableDirector(tableView: tableView)
tableDirector.appendSection(TableSectionBuilder(rows: [rowBuilder]))
tableDirector += TableSectionBuilder(rows: [rowBuilder])
```
### Cell actions
@ -124,13 +124,13 @@ Tablet provides a chaining approach to handle actions from your cells:
import Tablet
let rowBuilder = TableRowBuilder<User, MyTableViewCell>(items: [user1, user2, user3], id: "reusable_id")
.action(.configure) { data -> Void in
.action(.configure) { (data) in
}
.action(.click) { data -> Void in
.action(.click) { (data) in
}
.action(.shouldHighlight) { data -> ReturnValue in
.valueAction(.shouldHighlight) { (data) in
return false
}
@ -154,14 +154,14 @@ And receive this actions with your row builder:
```swift
import Tablet
let rowBuilder = TableConfigurableRowBuilder<User, MyTableViewCell>(items: users, id: "reusable_id")
.action(.click) { data -> Void in
let rowBuilder = TableRowBuilder<User, MyTableViewCell>(items: users, id: "reusable_id")
.action(.click) { (data) in
}
.action(.willDisplay) { data -> Void in
.action(.willDisplay) { (data) in
}
.action(kMyAction) { data -> Void in
.action(kMyAction) { (data) in
}
```
@ -186,7 +186,7 @@ extension TableDirector {
Catch your action with row builder:
```swift
let rowBuilder = TableConfigurableRowBuilder<User, MyTableViewCell>(items: users)
.action(kTableDirectorDidEndDisplayingCell) { data -> Void in
.action(kTableDirectorDidEndDisplayingCell) { (data) -> Void in
}
```