add init to builder

This commit is contained in:
Max Sokolov 2016-06-12 23:49:06 +03:00
parent 533c6e6eb8
commit 42eec9243e
1 changed files with 8 additions and 4 deletions

View File

@ -24,16 +24,20 @@ public protocol RowBuilder {
}
public class TableRowBuilder<ItemType, CellType: ConfigurableCell where CellType.T == ItemType, CellType: UITableViewCell>: RowBuilder {
public typealias BuilderHandler = (TableRowBuilder) -> ()
public var items: [ItemType]?
public var actions: [TableRowAction<ItemType, CellType>]?
public init(handler: BuilderHandler) {
public init(handler: (TableRowBuilder) -> ()) {
handler(self)
}
public init(items: [ItemType], actions: [TableRowAction<ItemType, CellType>]? = nil) {
self.items = items
self.actions = actions
}
// MARK: - RowBuilder -
public func rowItems() -> [Row]? {