estimatedRowHeight now is not optional
This commit is contained in:
parent
5a61eba23e
commit
ca851b6a9f
|
|
@ -56,14 +56,14 @@ public class TableRowBuilder<I, C where C: UITableViewCell> : RowBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public init(item: I, id: String? = nil, estimatedRowHeight: CGFloat = UITableViewAutomaticDimension) {
|
||||
public init(item: I, id: String? = nil, estimatedRowHeight: CGFloat) {
|
||||
|
||||
reusableIdentifier = id ?? NSStringFromClass(C).componentsSeparatedByString(".").last ?? ""
|
||||
self.estimatedRowHeight = estimatedRowHeight
|
||||
items.append(item)
|
||||
}
|
||||
|
||||
public init(items: [I]? = nil, id: String? = nil, estimatedRowHeight: CGFloat = UITableViewAutomaticDimension) {
|
||||
public init(items: [I]? = nil, id: String? = nil, estimatedRowHeight: CGFloat) {
|
||||
|
||||
reusableIdentifier = id ?? NSStringFromClass(C).componentsSeparatedByString(".").last ?? ""
|
||||
self.estimatedRowHeight = estimatedRowHeight
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
504740931C4FEEC50012132B /* TableDirectorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504740921C4FEEC50012132B /* TableDirectorExtensions.swift */; };
|
||||
508B71841BF48DD300272920 /* TableSectionBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508B71831BF48DD300272920 /* TableSectionBuilder.swift */; };
|
||||
508B71861BF48E0D00272920 /* TableRowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508B71851BF48E0D00272920 /* TableRowBuilder.swift */; };
|
||||
DA1BCD0F1BF5472C00CC0479 /* TableDirector.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1BCD0E1BF5472C00CC0479 /* TableDirector.swift */; };
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
504740921C4FEEC50012132B /* TableDirectorExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirectorExtensions.swift; sourceTree = "<group>"; };
|
||||
508B71831BF48DD300272920 /* TableSectionBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableSectionBuilder.swift; sourceTree = "<group>"; };
|
||||
508B71851BF48E0D00272920 /* TableRowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableRowBuilder.swift; sourceTree = "<group>"; };
|
||||
DA1BCD0E1BF5472C00CC0479 /* TableDirector.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableDirector.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -73,6 +75,7 @@
|
|||
DAB7EB291BEF787300D2AD5E /* TabletDemo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
504740921C4FEEC50012132B /* TableDirectorExtensions.swift */,
|
||||
DAB7EB2A1BEF787300D2AD5E /* AppDelegate.swift */,
|
||||
DAB7EB2C1BEF787300D2AD5E /* ViewController.swift */,
|
||||
DAB7EB3F1BEFD07E00D2AD5E /* ConfigurableTableViewCell.swift */,
|
||||
|
|
@ -178,6 +181,7 @@
|
|||
DAED08F11C14DE7E006C04D8 /* MyTableViewCell.swift in Sources */,
|
||||
DAF003961C14DC0C0028C3D6 /* MyNibTableViewCell.swift in Sources */,
|
||||
508B71861BF48E0D00272920 /* TableRowBuilder.swift in Sources */,
|
||||
504740931C4FEEC50012132B /* TableDirectorExtensions.swift in Sources */,
|
||||
DA1BCD0F1BF5472C00CC0479 /* TableDirector.swift in Sources */,
|
||||
DAB7EB401BEFD07E00D2AD5E /* ConfigurableTableViewCell.swift in Sources */,
|
||||
DAB7EB2B1BEF787300D2AD5E /* AppDelegate.swift in Sources */,
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// TableDirectorExtensions.swift
|
||||
// TabletDemo
|
||||
//
|
||||
// Created by Max Sokolov on 20/01/16.
|
||||
// Copyright © 2016 Tablet. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
extension TableDirector {
|
||||
|
||||
public func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
|
||||
|
||||
invokeAction(.custom(""), cell: nil, indexPath: nil)
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ class ViewController: UIViewController {
|
|||
|
||||
tableDirector = TableDirector(tableView: tableView)
|
||||
|
||||
let rowBuilder = TableRowBuilder<Int, UITableViewCell>(items: [1, 2, 3, 4], id: "cell")
|
||||
let rowBuilder = TableRowBuilder<Int, UITableViewCell>(items: [1, 2, 3, 4], id: "cell", estimatedRowHeight: 44)
|
||||
.action(.configure) { data in
|
||||
|
||||
data.cell?.textLabel?.text = "\(data.item)"
|
||||
|
|
@ -54,12 +54,12 @@ class ViewController: UIViewController {
|
|||
data.cell!.contentLabel.text = "Tablet is a super lightweight yet powerful generic library that handles a complexity of UITableView's datasource and delegate methods in a Swift environment. Tablet's goal is to provide an easiest way to create complex table views. With Tablet you don't have to write a messy code of switch or if statements when you deal with bunch of different cells in different sections."
|
||||
}
|
||||
|
||||
let myRowBuilder = TableRowBuilder<Int, MyTableViewCell>(item: 0, id: "cellll")
|
||||
let myRowBuilder = TableRowBuilder<Int, MyTableViewCell>(item: 0, id: "cellll", estimatedRowHeight: 44)
|
||||
|
||||
let sectionBuilder = TableSectionBuilder(headerTitle: "Tablet", footerTitle: "Deal with table view like a boss.", rowBuilders: [rowBuilder, configurableRowBuilder, myRowBuilder])
|
||||
|
||||
tableDirector += sectionBuilder
|
||||
|
||||
sectionBuilder.appendRowBuilder(TableRowBuilder<Int, MyNibTableViewCell>(item: 0))
|
||||
sectionBuilder.appendRowBuilder(TableRowBuilder<Int, MyNibTableViewCell>(item: 0, estimatedRowHeight: 44))
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue