diff --git a/README.md b/README.md index eb24614..7fd91f7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

Build Status - Swift 4.0 compatible + Swift 4.0 compatible Carthage compatible CocoaPods compatible Platform iOS @@ -53,29 +53,29 @@ Done. Your table is ready. Your cells have to conform to `ConfigurableCell` prot ```swift class StringTableViewCell: UITableViewCell, ConfigurableCell { - func configure(with string: String) { + func configure(with string: String) { - textLabel?.text = string - } + textLabel?.text = string + } } class UserTableViewCell: UITableViewCell, ConfigurableCell { - static var estimatedHeight: CGFloat? { - return 100 - } - - // is not required to be implemented - // by default reuse id is equal to cell's class name - static var reuseIdentifier: String { - return "my id" + static var estimatedHeight: CGFloat? { + return 100 } - func configure(with user: User) { + // is not required to be implemented + // by default reuse id is equal to cell's class name + static var reuseIdentifier: String { + return "my id" + } + + func configure(with user: User) { - textLabel?.text = user.name - detailTextLabel?.text = "Rating: \(user.rating)" - } + textLabel?.text = user.name + detailTextLabel?.text = "Rating: \(user.rating)" + } } ``` You could have as many rows and sections as you need. @@ -86,12 +86,12 @@ It nice to have some actions that related to your cells: ```swift let action = TableRowAction(.click) { (options) in - // you could access any useful information that relates to the action + // you could access any useful information that relates to the action - // options.cell - StringTableViewCell? - // options.item - String - // options.indexPath - IndexPath - // options.userInfo - [AnyHashable: Any]? + // options.cell - StringTableViewCell? + // options.item - String + // options.indexPath - IndexPath + // options.userInfo - [AnyHashable: Any]? } let row = TableRow(item: "some", actions: [action]) @@ -99,12 +99,12 @@ let row = TableRow(item: "some", actions: [action]) Or, using nice chaining approach: ```swift let row = TableRow(item: "some") - .on(.click) { (options) in + .on(.click) { (options) in - } - .on(.shouldHighlight) { (options) -> Bool in - return false - } + } + .on(.shouldHighlight) { (options) -> Bool in + return false + } ``` You could find all available actions [here](Sources/TableRowAction.swift). @@ -119,10 +119,10 @@ struct MyActions { class MyTableViewCell: UITableViewCell, ConfigurableCell { - @IBAction func myButtonClicked(sender: UIButton) { + @IBAction func myButtonClicked(sender: UIButton) { - TableCellAction(key: MyActions.ButtonClicked, sender: self).invoke() - } + TableCellAction(key: MyActions.ButtonClicked, sender: self).invoke() + } } ``` And handle them accordingly: @@ -158,9 +158,9 @@ By default TableKit relies on