bump readme
This commit is contained in:
parent
24d3540dd5
commit
9ba8ef4932
22
README.md
22
README.md
|
|
@ -4,7 +4,7 @@
|
|||
<a href="https://travis-ci.org/maxsokolov/TableKit"><img src="https://api.travis-ci.org/maxsokolov/TableKit.svg" alt="Build Status" /></a>
|
||||
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/Swift_3.0-compatible-4BC51D.svg?style=flat" alt="Swift 3.0 compatible" /></a>
|
||||
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
|
||||
<a href="https://cocoapods.org/pods/tablekit"><img src="https://img.shields.io/badge/pod-1.3.1-blue.svg" alt="CocoaPods compatible" /></a>
|
||||
<a href="https://cocoapods.org/pods/tablekit"><img src="https://img.shields.io/badge/pod-1.4.0-blue.svg" alt="CocoaPods compatible" /></a>
|
||||
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
|
||||
<a href="https://raw.githubusercontent.com/maxsokolov/tablekit/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
|
||||
</p>
|
||||
|
|
@ -36,9 +36,9 @@ Create your rows:
|
|||
```swift
|
||||
import TableKit
|
||||
|
||||
let row1 = TableRow<String, StringTableViewCell>(item: "1")
|
||||
let row2 = TableRow<Int, IntTableViewCell>(item: 2)
|
||||
let row3 = TableRow<User, UserTableViewCell>(item: User(name: "John Doe", rating: 5))
|
||||
let row1 = TableRow<StringTableViewCell>(item: "1")
|
||||
let row2 = TableRow<IntTableViewCell>(item: 2)
|
||||
let row3 = TableRow<UserTableViewCell>(item: User(name: "John Doe", rating: 5))
|
||||
```
|
||||
Put rows into section:
|
||||
```swift
|
||||
|
|
@ -84,20 +84,20 @@ You could have as many rows and sections as you need.
|
|||
|
||||
It nice to have some actions that related to your cells:
|
||||
```swift
|
||||
let action = TableRowAction<String, StringTableViewCell>(.click) { (data) in
|
||||
let action = TableRowAction<StringTableViewCell>(.click) { (data) in
|
||||
|
||||
// you could access any useful information that relates to the action
|
||||
|
||||
// data.cell - StringTableViewCell?
|
||||
// data.item - String
|
||||
// data.indexPath - NSIndexPath
|
||||
// data.indexPath - IndexPath
|
||||
}
|
||||
|
||||
let row = TableRow<String, StringTableViewCell>(item: "some", actions: [action])
|
||||
let row = TableRow<StringTableViewCell>(item: "some", actions: [action])
|
||||
```
|
||||
Or, using nice chaining approach:
|
||||
```swift
|
||||
let row = TableRow<String, StringTableViewCell>(item: "some")
|
||||
let row = TableRow<StringTableViewCell>(item: "some")
|
||||
.action(.click) { (data) in
|
||||
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ class MyTableViewCell: UITableViewCell, ConfigurableCell {
|
|||
```
|
||||
And handle them accordingly:
|
||||
```swift
|
||||
let myAction = TableRowAction<Void, MyTableViewCell>(.custom(MyActions.ButtonClicked)) { (data) in
|
||||
let myAction = TableRowAction<MyTableViewCell>(.custom(MyActions.ButtonClicked)) { (data) in
|
||||
|
||||
}
|
||||
```
|
||||
|
|
@ -173,11 +173,11 @@ It's never been so easy to deal with table views.
|
|||
```swift
|
||||
let users = /* some users array */
|
||||
|
||||
let click = TableRowAction<String, UserTableViewCell>(.click) {
|
||||
let click = TableRowAction<UserTableViewCell>(.click) {
|
||||
|
||||
}
|
||||
|
||||
let rows = users.filter({ $0.state == .active }).map({ TableRow<String, UserTableViewCell>(item: $0.name, actions: [click]) })
|
||||
let rows = users.filter({ $0.state == .active }).map({ TableRow<UserTableViewCell>(item: $0.name, actions: [click]) })
|
||||
|
||||
tableDirector += rows
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue