Powerful tool for making your UITableView
usage simple and comfortable. It allows you to move your UITableView
configuration logic to separated objects and simply register, add and remove cells from your table view.
- iOS 8.0+
- Xcode 9.0+
Create a Cartfile
that lists the framework and run carthage update
. Follow the instructions to add the framework to your project.
github "rosberry/TableViewTools"
You can use CocoaPods to install TableViewTools by adding it to your Podfile
:
platform :ios, '8.0'
use_frameworks!
pod 'TableViewTools'
Drag Sources
folder from last release into your project.
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(cellClass: ExampleTableViewCell.self)
func height(in tableView: UITableView) -> CGFloat {
return 100
}
func cell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
let cell: ExampleTableViewCell = tableView.dequeueReusableCell()
return cell
}
}
- Dmitry Frishbuter, dmitry.frishbuter@rosberry.com
- Artem Novichkov, artem.novichkov@rosberry.com
- Nikita Ermolenko, nikita.ermolenko@rosberry.com
This project is owned and maintained by Rosberry. We build mobile apps for users worldwide 🌏.
Check out our open source projects, read our blog or give us a high-five on 🐦 @rosberryapps.
TableViewTools is available under the MIT license. See the LICENSE file for more info.