         frame.origin = origin
         headerView.frame = frame
     }
-}
-
-class TableView: UITableView {
-
-    required override init(frame: CGRect, style: UITableViewStyle) {
-        super.init(frame: frame, style: style)
-        configure()
-    }
-
-    required convenience init(coder aDecoder: NSCoder) {
-        self.init(frame: CGRectZero, style: .Plain)
-        configure()
-    }
-
-    func configure() {
-        allowsSelection = false
-        estimatedRowHeight = 200
-        rowHeight = UITableViewAutomaticDimension
-
-        let bundle = NSBundle(forClass: SectionCell.self)
-        registerNib(UINib(nibName: "SectionCell", bundle: bundle), forCellReuseIdentifier: "SectionCell")
-    }
-}
-
-
-class Button: UIButton {
-    var indexPath: NSIndexPath?
 }
    }
    let dataController = DataController()

    let tableView: TableView
    let headerView: HeaderView!
    required override public init(frame: CGRect) {
        tableView = TableView(frame: frame, style: .Plain)
        let bundle = NSBundle(forClass: View.self)
        headerView = UINib(nibName: "HeaderView", bundle: bundle).instantiateWithOwner(nil, options: nil)[0] as! HeaderView
        super.init(frame: frame)
        configure()
    }

    required public convenience init(coder aDecoder: NSCoder) {
        self.init(frame: CGRectZero)
    }
}

// MARK: Public methods

extension View {

    // Data

    public func reloadData() {
        tableView.reloadData()
    }

}

extension View {

    func configure() {
        addSubview(tableView)

        dataController.view = self


        tableView.addSubview(headerView)
        tableView.tableHeaderView = UIView(frame: headerView.frame)
    }
}

