 //    public override func setSelected(selected: Bool, animated: Bool) {
 //        super.setSelected(selected, animated: animated)
 //        if selected { (tableObject as! SACheckTableObject).onAction(sender: self) }
-//    }
-//}
-//
-//// Check Cell
-//public class SATextFieldTableObject: SATitleTableObject {
-//    public var text: String?
-//    public var placeholder: String?
-//    public var onAction: ((sender: SATextFieldTableViewCell) -> Void)
-//    init(cellIdentifier: String = "TextFieldCell", title: String?, text: String?, placeholder: String?,
-//         customization: ((cell: SATableViewCell) -> Void)? = nil, onAction: ((sender: SATextFieldTableViewCell) -> Void)) {
-//        self.text = text
-//        self.placeholder = placeholder
-//        self.onAction = onAction
-//        super.init(cellIdentifier: cellIdentifier, title: title, customization: customization, onSelection: { () -> Void in  })
 //    }
 //}
 //public class SATextFieldTableViewCell: SATitleTableViewCell {

    public func setOnAction(onAction: ((cell: C) -> Void)?) {
        self.onAction = onAction
    }
}

public class StaticTableViewCell: UITableViewCell {
    public class func defaultIdentifier() -> String { return "StaticTableViewCell" }
    public var tableItem: StaticTableItem<UITableViewCell>!
    public override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        tableItem.onSelection?(cell: self)
    }
}
public class TitleStaticTableViewCell: StaticTableViewCell {

}


public class StaticContent: NSObject, UITableViewDataSource {
    public var sections: [StaticContentSection] = []
    
    public func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return sections.count
    }
    
    public func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return sections[section].title
    }
    
    public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return sections[section].items.count
    }
    
    public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        return sections[indexPath.section].items[indexPath.row].dequeueReusableCell(tableView: tableView, indexPath: indexPath)
    }
    
}
public func += (inout left: StaticContent, right: StaticContentSection) {
    left.sections.append(right)
}


public class StaticContentSection {
    public var title: String?
    public var items: [StaticContentItemProtocol] = []
    public init(title: String? = nil) {
        self.title = title
    }
}
public func += (inout left: [StaticContentSection], right: StaticContentSection) {
    left.append(right)
}
public func += (inout left: StaticContentSection, right: StaticContentItemProtocol) {
    left.items.append(right)
}



public protocol StaticContentItemProtocol {
    func dequeueReusableCell(tableView tableView: UITableView, indexPath: NSIndexPath) -> StaticTableViewCell
    func doOnSelection(cell cell: StaticTableViewCell)
    func doOnAction(cell cell: StaticTableViewCell)
}

public class StaticContentItem<C: StaticTableViewCell>: StaticContentItemProtocol {
    public var cellIdentifier: String
    private var customization: ((cell: C) -> Void)?
    private var onSelection:   ((cell: C) -> Void)?
    private var onAction:      ((cell: C) -> Void)?
    public init(cellIdentifier: String) {
        self.cellIdentifier = cellIdentifier
    }
