Go to file
Max Sokolov 8509c8d64e bump readme 2016-06-13 01:07:46 +03:00
TableKit add init to builder 2016-06-12 23:49:06 +03:00
TableKit.xcworkspace rename to TableKit 2016-06-11 00:51:10 +03:00
TableKitDemo add row builder 2016-06-12 23:42:39 +03:00
Tests fix tests 2016-05-08 13:24:21 +03:00
.gitignore remove useless code, add gitignore 2016-04-16 22:48:46 +03:00
.travis.yml rename to TableKit 2016-06-11 00:51:10 +03:00
LICENSE added podspec and license 2015-11-08 23:47:15 +03:00
README.md bump readme 2016-06-13 01:07:46 +03:00
TableKit.podspec rename to TableKit 2016-06-11 00:51:10 +03:00

README.md

#TableKit

Build Status Swift 2.2 compatible Platform iOS CocoaPods compatible License: MIT

TableKit is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swifty way. TableKit's goal is to provide the easiest way to create complex table views. With TableKit 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.

Features

  • Type-safe cells based on generics
  • The easiest way to map your models or view models to cells
  • Correctly handles autolayout cells with multiline labels
  • Chainable cell actions (select/deselect etc.)
  • Support cells created from code, xib, or storyboard
  • Automatic xib/classes registration
  • No need to subclass
  • Extensibility
  • Tests

Usage

Create your rows:

let row1 = TableRow<String, StringTableViewCell>(item: "1")
let row2 = TableRow<String, IntTableViewCell>(item: 2)
let row3 = TableRow<String, FloatTableViewCell>(item: 3.0)

Put rows into section:

let s = TableSection(rows: [row1, row2, row3])

And configure 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:

class StringTableViewCell: UITableViewCell, ConfigurableCell {

	typealias T = String

	func configure(string: T) {
		titleLabel.text = string
	}

	static func estimatedHeight() -> CGFloat {
        return 44
    }
}

License

TableKit is available under the MIT license. See LICENSE for details.