Code review inspections fix vol. 4

This commit is contained in:
Anton Popkov 2017-10-13 16:47:28 +03:00
parent 9ab7dc8f52
commit cc26bdbd68
3 changed files with 14 additions and 10 deletions

View File

@ -37,9 +37,7 @@ public final class SeparatorRowBox {
/// - parameter row: TableRow which `cell` conforms to SeparatorCell
public init<T>(row: TableRow<T>) where T: SeparatorCell {
self.row = row
setSeparatorHandler = { separatorType in
row.set(separatorType: separatorType)
}
setSeparatorHandler = row.set
}
}

View File

@ -26,7 +26,12 @@ fileprivate let updateAppearanceActionId = "TableRowUpdateAppearanceActionId"
public extension TableRow where CellType: AppearanceProtocol {
@discardableResult func set(appearance: CellType.Appearance) -> Self {
func with(appearance: CellType.Appearance) -> Self {
set(appearance: appearance)
return self
}
func set(appearance: CellType.Appearance) {
removeAction(forActionId: updateAppearanceActionId)
let action = TableRowAction<CellType>(.configure) { options in
@ -35,8 +40,6 @@ public extension TableRow where CellType: AppearanceProtocol {
action.id = updateAppearanceActionId
on(action)
return self
}
}

View File

@ -22,11 +22,16 @@
import TableKit
private let configureSeparatorActionId = "TableRowConfigureSeparatorActionId"
fileprivate let configureSeparatorActionId = "TableRowConfigureSeparatorActionId"
public extension TableRow where CellType: SeparatorCell {
@discardableResult func set(separatorType: CellSeparatorType) -> Self {
func with(separatorType: CellSeparatorType) -> Self {
set(separatorType: separatorType)
return self
}
func set(separatorType: CellSeparatorType) {
removeAction(forActionId: configureSeparatorActionId)
let action = TableRowAction<CellType>(.configure) { options in
@ -35,8 +40,6 @@ public extension TableRow where CellType: SeparatorCell {
action.id = configureSeparatorActionId
on(action)
return self
}
}