Skip to content

Commit

Permalink
优化SpacerRow处理颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
fun committed Sep 28, 2022
1 parent 7a10b39 commit 096932e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Jenga.podspec
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 6 additions & 2 deletions Sources/Jenga/Core/Cell/SpacerCell.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
16 changes: 12 additions & 4 deletions Sources/Jenga/Core/Row/SpacerRow.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit

public struct SpacerRow<T: SpacerCell>: Row {
public struct SpacerRow<Cell: SpacerCell>: Row, RowConfigurable {

public var height: RowHeight?

public let color: UIColor
Expand All @@ -12,9 +12,9 @@ public struct SpacerRow<T: SpacerCell>: 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

Expand All @@ -27,4 +27,12 @@ public struct SpacerRow<T: SpacerCell>: Row {
self.color = color
self.estimatedHeight = .constant(height)
}

public func configure(_ cell: UITableViewCell) {
(cell as? Cell)?.configure(with: color)
}

public func recovery(_ cell: UITableViewCell) {

}
}

0 comments on commit 096932e

Please sign in to comment.