// // MainController.swift // TabletDemo // // Created by Max Sokolov on 16/04/16. // Copyright © 2016 Tablet. All rights reserved. // import UIKit import TableKit class MainController: UIViewController { @IBOutlet weak var tableView: UITableView! { didSet { tableDirector = TableDirector(tableView: tableView) } } var tableDirector: TableDirector! override func viewDidLoad() { super.viewDidLoad() title = "TableKit" let clickAction = TableRowAction(.click) { [weak self] (options) in switch options.indexPath.row { case 0: self?.performSegue(withIdentifier: "autolayoutcells", sender: nil) case 1: self?.performSegue(withIdentifier: "nibcells", sender: nil) default: break } } let printClickAction = TableRowAction(.click) { (options) in print("click", options.indexPath) } let rows = [ TableRow(item: "Autolayout cells", actions: [clickAction, printClickAction]), TableRow(item: "Nib cells", actions: [clickAction, printClickAction]) ] // automatically creates a section, also could be used like tableDirector.append(rows: rows) tableDirector += rows } }