Empowering UITableView with painless multi-type cell support and built-in automatic state transition animations
Empowering UITableView
with painless multi-type cell support and built-in automatic state transition animations
TableViewKit is designed:
UITableView
's delegatesCreate 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])
}
}
}
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"
/TableViewKit
folder in your project.