Add height for item
This commit is contained in:
parent
02f77ed699
commit
279fdd4854
|
|
@ -29,6 +29,8 @@ public protocol ConfigurableCell {
|
|||
static var defaultHeight: CGFloat? { get }
|
||||
|
||||
func configure(with _: T)
|
||||
func height(for _: T) -> CGFloat
|
||||
|
||||
}
|
||||
|
||||
public extension ConfigurableCell where Self: UITableViewCell {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public struct TableKitUserInfoKeys {
|
|||
public protocol RowConfigurable {
|
||||
|
||||
func configure(_ cell: UITableViewCell)
|
||||
func height(for _: UITableViewCell) -> CGFloat
|
||||
|
||||
}
|
||||
|
||||
public protocol RowActionable {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,11 @@ open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableView
|
|||
(cell as? CellType)?.configure(with: item)
|
||||
}
|
||||
|
||||
open func height(for cell: UITableViewCell) -> CGFloat {
|
||||
|
||||
return (cell as? CellType)?.height(for: item) ?? UITableViewAutomaticDimension
|
||||
}
|
||||
|
||||
// MARK: - RowActionable -
|
||||
|
||||
open func invoke(action: TableRowActionType, cell: UITableViewCell?, path: IndexPath, userInfo: [AnyHashable: Any]? = nil) -> Any? {
|
||||
|
|
|
|||
Loading…
Reference in New Issue