diff --git a/README.md b/README.md index e047841..72ea91a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ ![Tablet](https://raw.githubusercontent.com/maxsokolov/tablet/assets/tablet.png) +

+Platform iOS +Swift 2.1 compatible +License: MIT +

+ 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: @@ -50,7 +56,7 @@ let rowBuilder = TableRowBuilder(items: [user1, user2, us let sectionBuilder = TableSectionBuilder(headerTitle: "Users", rowBuilders: [rowBuilder]) -let director = TableDirector(tableView: tableView) +director = TableDirector(tableView: tableView) director.appendSections(sectionBuilder) ``` @@ -85,6 +91,7 @@ import Tablet let rowBuilder = TableConfigurableRowBuilder() rowBuilder.appendItems(users) +director = TableDirector(tableView: tableView) tableDirector.appendSection(TableSectionBuilder(rowBuilders: [rowBuilder])) ``` @@ -95,7 +102,7 @@ Tablet provides a chaining approach to handle actions from your cells: ```swift import Tablet -let rowBuilder = TableRowBuilder(items: [user1, user2, user3], id: "reusable_id") +let rowBuilder = TableRowBuilder(items: [user1, user2, user3], id: "reusable_id") .action(.configure) { data in } @@ -111,11 +118,13 @@ let rowBuilder = TableRowBuilder(items: [user1, user2, us ```swift import Tablet -class UserTableViewCell : UITableViewCell { +let kMyAction = "action_key" + +class MyTableViewCell : UITableViewCell { @IBAction func buttonClicked(sender: UIButton) { - Action(key: "action_key", sender: self, userInfo: nil).trigger() + Action(key: kMyAction, sender: self, userInfo: nil).trigger() } } ``` @@ -123,14 +132,14 @@ And receive this actions with your row builder: ```swift import Tablet -let rowBuilder = TableRowBuilder(items: users, id: "reusable_id") +let rowBuilder = TableConfigurableRowBuilder(items: users, id: "reusable_id", estimatedRowHeight: 42) .action(.click) { data in } .action(.willDisplay) { data in } - .action("action_key") { data in + .action(kMyAction) { data in } ``` diff --git a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate index 7cb6250..066f0b0 100644 Binary files a/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate and b/TabletDemo/TabletDemo.xcodeproj/project.xcworkspace/xcuserdata/maxsokolov.xcuserdatad/UserInterfaceState.xcuserstate differ