Empowering UITableView
with painless multi-type cell support and built-in automatic state transition animations
- Download TableViewKit and play with our examples
- First time with TableViewKit? Read the "Overview" section below
TableViewKit is designed:
- to easily develop custom sections with different headers, footers and multiple cell types
- to support stateful sections
- to enforce reusability and testability
- and last but not least, to forget
UITableView
's delegates
Create an TableItem
with a UITableViewCell
and CellDrawer
. An item may have a model of the data you want to display and may control the interaction if any.
class YourDrawer: CellDrawer {
// The type could be a custom UITableViewCell class, with or without a Nib
static var type = CellType.class(YourCustomCell.self)
static func draw(_ cell: YourCustomCell, with item: YourItem) {
// Draw by setting properties of your cell from the item
}
}
class YourItem: TableItem {
var drawer = AnyCellDrawer(YourDrawer.self)
// Your properties and methods
public init() { }
}
Create a custom TableSection
with your items.
class YourSection: TableSection {
var items: ObservableArray<TableItem>
var header: HeaderFooterView = .title("Your section")
public init() {
items = [YourItem(), AnotherItem(), AndAnotherItem()]
}
}
Ready to go, instantiate a TableViewManager
, in your UIViewController
with a UITableView
and the array of custom sections
class ViewController: UIViewController {
var tableViewManager: TableViewManager!
@IBOutlet weak var tableView: UITableView! {
didSet {
tableViewManager = TableViewManager(tableView: tableView, sections: [CustomSection])
}
}
}
- Xcode 8 or higher
- iOS 8.0 or higher
You can use CocoaPods to install TableViewKit
by adding it to your Podfile
:
platform :ios, '8.0'
use_frameworks!
pod 'TableViewKit'
To get the full benefits import TableViewKit
wherever you import UIKit
import UIKit
import TableViewKit
Create a Cartfile
that lists the framework and run carthage bootstrap
. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/TableViewKit.framework
to an iOS project.
github "odigeoteam/TableViewKit"
- Download and drop
/TableViewKit
folder in your project. - Congratulations!
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.