From a2f8bdde307b91a77f429ef6619017c1bd539ef2 Mon Sep 17 00:00:00 2001 From: Max Sokolov Date: Wed, 15 Jun 2016 20:42:10 +0300 Subject: [PATCH] add isPrototype property --- .../Presentation/Views/StoryboardImageTableViewCell.swift | 2 +- .../Presentation/Views/StoryboardTableViewCell.swift | 2 +- Sources/ConfigurableCell.swift | 2 +- Sources/HeightStrategy.swift | 2 +- Sources/TableDirector.swift | 2 +- Sources/TableRow.swift | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Demo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift b/Demo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift index a466f9a..6d0df90 100644 --- a/Demo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift +++ b/Demo/Classes/Presentation/Views/StoryboardImageTableViewCell.swift @@ -17,7 +17,7 @@ class StoryboardImageTableViewCell: UITableViewCell, ConfigurableCell { @IBOutlet var subtitleLabel: UILabel! @IBOutlet var customImageView: UIImageView! - func configure(string: T) { + func configure(string: T, isPrototype: Bool) { titleLabel.text = string subtitleLabel.text = "Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.Copyright © 2016 Tablet. All rights reserved.1" diff --git a/Demo/Classes/Presentation/Views/StoryboardTableViewCell.swift b/Demo/Classes/Presentation/Views/StoryboardTableViewCell.swift index 8180860..a8b84c0 100644 --- a/Demo/Classes/Presentation/Views/StoryboardTableViewCell.swift +++ b/Demo/Classes/Presentation/Views/StoryboardTableViewCell.swift @@ -13,7 +13,7 @@ class StoryboardTableViewCell: UITableViewCell, ConfigurableCell { typealias T = String - func configure(value: T) { + func configure(value: T, isPrototype: Bool) { textLabel?.text = value } } \ No newline at end of file diff --git a/Sources/ConfigurableCell.swift b/Sources/ConfigurableCell.swift index 4127139..3e42f17 100644 --- a/Sources/ConfigurableCell.swift +++ b/Sources/ConfigurableCell.swift @@ -27,7 +27,7 @@ public protocol ConfigurableCell { static func reusableIdentifier() -> String static func estimatedHeight() -> CGFloat static func defaultHeight() -> CGFloat? - func configure(_: T) + func configure(_: T, isPrototype: Bool) } public extension ConfigurableCell where Self: UITableViewCell { diff --git a/Sources/HeightStrategy.swift b/Sources/HeightStrategy.swift index 43243ff..084018c 100644 --- a/Sources/HeightStrategy.swift +++ b/Sources/HeightStrategy.swift @@ -48,7 +48,7 @@ public class PrototypeHeightStrategy: CellHeightCalculatable { cell.bounds = CGRectMake(0, 0, tableView?.bounds.size.width ?? 0, cell.bounds.height) - row.configure(cell) + row.configure(cell, isPrototype: true) cell.setNeedsLayout() cell.layoutIfNeeded() diff --git a/Sources/TableDirector.swift b/Sources/TableDirector.swift index 42f018c..72b8fb1 100644 --- a/Sources/TableDirector.swift +++ b/Sources/TableDirector.swift @@ -118,7 +118,7 @@ public class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate cell.layoutIfNeeded() } - row.configure(cell) + row.configure(cell, isPrototype: false) return cell } diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index e4b3fbb..ff33a2e 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -22,7 +22,7 @@ import UIKit public protocol RowConfigurable { - func configure(cell: UITableViewCell) + func configure(cell: UITableViewCell, isPrototype: Bool) } public protocol RowActionable { @@ -72,8 +72,8 @@ public class TableRow