TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Feb 2018 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Dmitry Frishbuter, Nikita Ermolenko.
This repo contains the powerful tool for making your UITableView usage simply and comfortable! It allows you to move your UITableView configuration logic to separated objects, such as inheritors of TableViewSectionItemProtocol and TableViewCellItemProtocol, and simply register, add and remove cells from your table view.
To run the example project, run pod try
, or simply clone the repo and open project Example-iOS.
manager = TableViewManager(tableView: tableView)
let titles = ["Item 1", "Item 2", "Item 3"]
var cellItems = [ExampleTableViewCellItem]()
titles.forEach { title in
let cellItem = ExampleTableViewCellItem(title: title)
cellItems.append(cellItem)
}
let sectionItem = TableViewSectionItem(cellItems: cellItems)
manager.sectionItems = [sectionItem]
For basic usage, inside cell item should be implemented these entries from TableViewCellItemProtocol:
class ExampleTableViewCellItem: TableViewCellItemProtocol {
var reuseType: ReuseType {
return ReuseType(cellClass: ExampleTableViewCell.self)
}
func height(in tableView: UITableView) -> CGFloat {
return 100
}
func cellForTableView(tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
let cell: ExampleTableViewCell = tableView.dequeueReusableCell()
return cell
}
}
TableViewTools is available under the MIT license. See the LICENSE file for more info.