测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最后发布 | 2018年2月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Dmitry Frishbuter、Nikita Ermolenko 维护。
此仓库包含制作您的 UITableView 使用简单且舒适的有力工具!它允许您将您的 UITableView 配置逻辑移至分离的对象,例如继承自 TableViewSectionItemProtocol 和 TableViewCellItemProtocol 的对象,并简单地注册、添加和从您的表格视图中删除单元格。
要运行示例项目,请运行 pod try
,或者简单克隆仓库并打开项目 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]
对于基本用法,在单元格项中应实现这些来自 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 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。