Skip to content

Latest commit

 

History

History
122 lines (89 loc) · 3.89 KB

README.md

File metadata and controls

122 lines (89 loc) · 3.89 KB

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 TableItem 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: TableItem {

    var drawer = AnyCellDrawer(YourDrawer.self)

    // Your properties and methods

    public init() { }
}

Create a custom TableSection with your items.

class YourSection: TableSection {
    var items: ObservableArray<TableItem>

    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

CocoaPods

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

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

To get the full benefits import TableViewKit wherever you import UIKit

import UIKit
import TableViewKit

Carthage

Create a Cartfile that lists the framework and run carthage bootstrap. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/TableViewKit.framework to an iOS project.

github "odigeoteam/TableViewKit"

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.