TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2017 |
SPMSupports SPM | ✗ |
Maintained by Alfredo Delli Bovi, Nelson.
Empowering UITableView
with painless multi-type cell support and built-in automatic state transition animations
TableViewKit is designed:
UITableView
‘s delegatesCreate an Item
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: Item {
var drawer = AnyCellDrawer(YourDrawer.self)
// Your properties and methods
public init() { }
}
Create a custom Section
with your items.
class YourSection: Section {
var items: ObservableArray<Item>
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])
}
}
}
/TableViewKit
folder in your project.