From 096932e9c972568e3181cc94d4d825505b1814ce Mon Sep 17 00:00:00 2001 From: fun Date: Wed, 28 Sep 2022 13:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96SpacerRow=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenga.podspec | 2 +- Sources/Jenga/Core/Cell/SpacerCell.swift | 8 ++++++-- Sources/Jenga/Core/Row/SpacerRow.swift | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Jenga.podspec b/Jenga.podspec index 3d4aefa..8c94611 100644 --- a/Jenga.podspec +++ b/Jenga.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "Jenga" -s.version = "1.1.8" +s.version = "1.1.9" s.summary = "像SwiftUI一样使用DSL代码搭建UITableView" s.homepage = "https://github.com/fanglinwei/Jenga" diff --git a/Sources/Jenga/Core/Cell/SpacerCell.swift b/Sources/Jenga/Core/Cell/SpacerCell.swift index ff7ae93..4392060 100644 --- a/Sources/Jenga/Core/Cell/SpacerCell.swift +++ b/Sources/Jenga/Core/Cell/SpacerCell.swift @@ -1,5 +1,9 @@ import UIKit -open class SpacerCell: UITableViewCell { - +open class SpacerCell: UITableViewCell, ConfigurableCell { + public typealias CellData = UIColor + open func configure(with data: CellData) { + contentView.backgroundColor = data + backgroundColor = data + } } diff --git a/Sources/Jenga/Core/Row/SpacerRow.swift b/Sources/Jenga/Core/Row/SpacerRow.swift index 6d1afd2..b4fd46d 100644 --- a/Sources/Jenga/Core/Row/SpacerRow.swift +++ b/Sources/Jenga/Core/Row/SpacerRow.swift @@ -1,7 +1,7 @@ import UIKit -public struct SpacerRow: Row { - +public struct SpacerRow: Row, RowConfigurable { + public var height: RowHeight? public let color: UIColor @@ -12,9 +12,9 @@ public struct SpacerRow: Row { public var action: RowAction? - public let cellType: UITableViewCell.Type = T.self + public let cellType: UITableViewCell.Type = Cell.self - public var reuseIdentifier: String { T.reuseIdentifier } + public var reuseIdentifier: String { Cell.reuseIdentifier } public var selectionStyle: UITableViewCell.SelectionStyle = .none @@ -27,4 +27,12 @@ public struct SpacerRow: Row { self.color = color self.estimatedHeight = .constant(height) } + + public func configure(_ cell: UITableViewCell) { + (cell as? Cell)?.configure(with: color) + } + + public func recovery(_ cell: UITableViewCell) { + + } }