diff --git a/README.md b/README.md
index f740cc1..ba40144 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
-
+
@@ -17,7 +17,7 @@ It hides a complexity of `UITableViewDataSource` and `UITableViewDelegate` metho
- [x] Type-safe generic cells
- [x] Functional programming style friendly
- [x] The easiest way to map your models or view models to cells
-- [x] Automatic cell registration
+- [x] Automatic cell registration*
- [x] Correctly handles autolayout cells with multiline labels
- [x] Chainable cell actions (select/deselect etc.)
- [x] Support cells created from code, xib, or storyboard
@@ -36,7 +36,7 @@ Create your rows:
```swift
let row1 = TableRow(item: "1")
let row2 = TableRow(item: 2)
-let row3 = TableRow(item: 3.0)
+let row3 = TableRow(item: User(name: "John Doe", rating: 5))
```
Put rows into section:
```swift
@@ -47,19 +47,27 @@ And setup your table:
let tableDirector = TableDirector(tableView: tableView)
tableDirector += section
```
-Done. Your table is ready. You may want to look at your cell. It has to conform to `ConfigurableCell` protocol:
+Done. Your table is ready. Your cells have to conform to `ConfigurableCell` protocol:
```swift
class StringTableViewCell: UITableViewCell, ConfigurableCell {
- typealias T = String
+ func configure(with string: String) {
+
+ textLabel?.text = string
+ }
+}
- func configure(string: T, isPrototype: Bool) {
- titleLabel.text = string
+class UserTableViewCell: UITableViewCell, ConfigurableCell {
+
+ static var estimatedHeight: CGFloat? {
+ return 100
}
- static func estimatedHeight() -> CGFloat {
- return 44
- }
+ func configure(with user: User) {
+
+ textLabel?.text = user.name
+ detailTextLabel?.text = "Rating: \(user.rating)"
+ }
}
```
You could have as many rows and sections as you need.
@@ -74,7 +82,7 @@ let action = TableRowAction(.click) { (data) in
// data.cell - StringTableViewCell?
// data.item - String
- // data.path - NSIndexPath
+ // data.indexPath - NSIndexPath
}
let row = TableRow(item: "some", actions: [action])
@@ -82,12 +90,12 @@ let row = TableRow(item: "some", actions: [action])
Or, using nice chaining approach:
```swift
let row = TableRow(item: "some")
- .action(TableRowAction(.click) { (data) in
+ .action(.click) { (data) in
- })
- .action(TableRowAction(.shouldHighlight) { (data) -> Bool in
+ }
+ .action(.shouldHighlight) { (data) -> Bool in
return false
- })
+ }
```
You could find all available actions [here](Sources/TableRowAction.swift).