diff --git a/Demo/Classes/Presentation/Views/AutolayoutTableViewCell.swift b/Demo/Classes/Presentation/Views/AutolayoutTableViewCell.swift index 6f5f7c4..ec505d6 100644 --- a/Demo/Classes/Presentation/Views/AutolayoutTableViewCell.swift +++ b/Demo/Classes/Presentation/Views/AutolayoutTableViewCell.swift @@ -19,13 +19,13 @@ class AutolayoutTableViewCell: UITableViewCell, ConfigurableCell { @IBOutlet var titleLabel: UILabel! @IBOutlet var subtitleLabel: UILabel! + static var estimatedHeight: CGFloat? { + return 500 + } + func configure(with string: T) { titleLabel.text = LoremIpsumTitle subtitleLabel.text = LoremIpsumBody } - - static func estimatedHeight() -> CGFloat? { - return 500 - } } \ No newline at end of file diff --git a/Demo/Classes/Presentation/Views/NibTableViewCell.swift b/Demo/Classes/Presentation/Views/NibTableViewCell.swift index 74b4a27..d561314 100644 --- a/Demo/Classes/Presentation/Views/NibTableViewCell.swift +++ b/Demo/Classes/Presentation/Views/NibTableViewCell.swift @@ -13,11 +13,11 @@ class NibTableViewCell: UITableViewCell, ConfigurableCell { @IBOutlet weak var titleLabel: UILabel! + static var defaultHeight: CGFloat? { + return 100 + } + func configure(with number: Int) { titleLabel.text = "\(number)" } - - static func defaultHeight() -> CGFloat? { - return 100 - } } \ No newline at end of file diff --git a/Sources/ConfigurableCell.swift b/Sources/ConfigurableCell.swift index 6c37e1f..021bad6 100644 --- a/Sources/ConfigurableCell.swift +++ b/Sources/ConfigurableCell.swift @@ -21,17 +21,18 @@ import UIKit public protocol ReusableCell { - + static func reusableIdentifier() -> String static func nib() -> UINib? } public protocol ConfigurableCell: ReusableCell { - + associatedtype T - - static func estimatedHeight() -> CGFloat? - static func defaultHeight() -> CGFloat? + + static var estimatedHeight: CGFloat? { get } + static var defaultHeight: CGFloat? { get } + func configure(with _: T) } @@ -48,11 +49,16 @@ public extension ReusableCell where Self: UITableViewCell { public extension ConfigurableCell where Self: UITableViewCell { - static func estimatedHeight() -> CGFloat? { - return UITableViewAutomaticDimension + static var estimatedHeight: CGFloat? { + get { + return UITableViewAutomaticDimension + } + } - static func defaultHeight() -> CGFloat? { - return nil + static var defaultHeight: CGFloat? { + get { + return nil + } } } \ No newline at end of file diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index d4f56e3..e0af219 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -59,11 +59,11 @@ public class TableRow