Skip to content

Powerful tool for making your UITableView usage simple and comfortable

License

Notifications You must be signed in to change notification settings

rosberry/TableViewTools

Repository files navigation

TableViewTools

Platform Swift Version Carthage Compatible CocoaPods Compatible PRs Welcome

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.

Requirements

  • iOS 8.0+
  • Xcode 9.0+

Installation

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add the framework to your project.

github "rosberry/TableViewTools"

CocoaPods

You can use CocoaPods to install TableViewTools by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'TableViewTools'

Manually

Drag Sources folder from last release into your project.

Basic usage

Creating manager

manager = TableViewManager(tableView: tableView)

Creating section

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]

Cell item implementation

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
    }
}

Authors

About

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.

License

TableViewTools is available under the MIT license. See the LICENSE file for more info.

About

Powerful tool for making your UITableView usage simple and comfortable

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published