A simaple UI Binder for swift
*** Still in development, DO NOT USE ***
Bind to any existing UIControlEvents
anyUiControl.bindControlEvent(.AllEvents) { print("Any Event") }
button.bindTap { print("tap on button") }
textField.bindTextChange { print("text value: \($0)") }
segmentedControl.bindValueChange { print("selected index \($0)") }
Populate a table, this will use the class name as the cell identifier
tableview
.bindNumberOfRowsForSection { _ in self.tableData.count }
.bindCell(AwesomeCell.self) { indexPath, cell in cell.configure(self.tableData[indexPath.row]) }
Provide custom identifier for the cells
tableview
.bindNumberOfRowsForSection { _ in self.tableData.count }
.bindCellIdentifier { _ in "AwesomeCellNumber2" }
.bindCell(AwesomeCell.self) { indexPath, cell in cell.configure(self.tableData[indexPath.row]) }
Customize number of section
tableview
.bindNumberOfSections { return 2 }
.bindNumberOfRowsForSection { _ in self.tableData.count }
.bindCell(AwesomeCell.self) { indexPath, cell in cell.configure(self.tableData[indexPath.row]) }
Selection & Deselection
tableview
.bindNumberOfRowsForSection { _ in self.tableData.count }
.bindCell(AwesomeCell.self) { indexPath, cell in cell.configure(self.tableData[indexPath.row]) }
.bindSelection { indexPath in print("selected row: \(self.tableData[indexPath.row]))") }
.bindDeselection { indexPath in print("deselected row: \(self.tableData[indexPath.row]))") }