fix operators

This commit is contained in:
Max Sokolov 2016-06-12 15:27:50 +03:00
parent 699d2aa00d
commit 653948ec08
5 changed files with 16 additions and 36 deletions

View File

@ -21,9 +21,9 @@
import UIKit
public protocol ConfigurableCell {
associatedtype T
static func reusableIdentifier() -> String
static func estimatedHeight() -> CGFloat
static func defaultHeight() -> CGFloat?
@ -31,15 +31,15 @@ public protocol ConfigurableCell {
}
public extension ConfigurableCell where Self: UITableViewCell {
static func reusableIdentifier() -> String {
return String(self)
}
static func estimatedHeight() -> CGFloat {
return UITableViewAutomaticDimension
}
static func defaultHeight() -> CGFloat? {
return nil
}

View File

@ -18,37 +18,20 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// -
/*public func +=(left: TableDirector, right: RowBuilder) {
left.append(section: TableSectionBuilder(rows: [right]))
}
public func +=(left: TableDirector, right: [RowBuilder]) {
left.append(section: TableSectionBuilder(rows: right))
}
public func +=(left: TableDirector, right: TableSectionBuilder) {
// --
public func +=(left: TableDirector, right: TableSection) {
left.append(section: right)
}
public func +=(left: TableDirector, right: [TableSectionBuilder]) {
public func +=(left: TableDirector, right: [TableSection]) {
left.append(sections: right)
}
// -
public func +=<DataType, CellType>(left: TableRowBuilder<DataType, CellType>, right: DataType) {
left.append(items: [right])
}
public func +=<DataType, CellType>(left: TableRowBuilder<DataType, CellType>, right: [DataType]) {
left.append(items: right)
}
// -
public func +=(left: TableSectionBuilder, right: RowBuilder) {
// --
public func +=(left: TableSection, right: Row) {
left.append(row: right)
}
public func +=(left: TableSectionBuilder, right: [RowBuilder]) {
public func +=(left: TableSection, right: [Row]) {
left.append(rows: right)
}*/
}

View File

@ -75,9 +75,7 @@ public class TableRowAction<ItemType, CellType: ConfigurableCell where CellType.
self.type = type
self.handler = handler
}
// MARK: - RowAction -
func invoke(item item: ItemType, cell: UITableViewCell?, path: NSIndexPath) -> Any? {
return handler(data: TableRowActionData(item: item, cell: cell as? CellType, path: path, userInfo: nil))
}

View File

@ -71,9 +71,8 @@ public class TableSection {
public func append(row row: Row) {
append(rows: [row])
}
public func append(rows rows: [Row]) {
items.appendContentsOf(rows)
}
}

View File

@ -62,7 +62,7 @@ class MainController: UIViewController {
let section = TableSection(headerTitle: "", footerTitle: "", rows: [row1, row2, row3])
tableDirector += [section]
tableDirector.append(section: section)