TableViewKit 1.2.0

TableViewKit 1.2.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Oct 2017
SPMSupports SPM

Maintained by Nelson, Alfredo Delli Bovi.



  • By
  • TableViewKit Contributors

TableViewKit


Empowering UITableView with painless multi-type cell support and built-in automatic state transition animations

Getting Started

Overview

TableViewKit is designed:

  • to easily develop custom sections with different headers, footers and multiple cell types
  • to support stateful sections
  • to enforce reusability and testability
  • and last but not least, to forget UITableView‘s delegates

Quickstart

Create an Item 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: Item {

    var drawer = AnyCellDrawer(YourDrawer.self)

    // Your properties and methods

    public init() { }
}

Create a custom Section with your items.

class YourSection: Section {
    var items: ObservableArray<Item>

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

Examples

Requirements

  • Xcode 8 or higher
  • iOS 8.0 or higher

Installation

Manually

  1. Download and drop /TableViewKit folder in your project.
  2. Congratulations!

Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.