Skip to content

Commit 9ead011

Browse files
authored
Add display options for first and second PickerInlineRow (#2246)
1 parent c255e4b commit 9ead011

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Source/Rows/PickerInlineRow.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ open class _DoublePickerInlineRow<A, B> : Row<PickerInlineCell<Tuple<A, B>>>, No
102102

103103
/// Options for second component given the selected value from the first component. Will be called often so should be O(1)
104104
public var secondOptions: ((A) -> [B]) = { _ in [] }
105+
106+
/// Modify the displayed values for the first picker row.
107+
public var displayValueForFirstRow: ((A) -> (String)) = { a in return String(describing: a) }
108+
109+
/// Modify the displayed values for the second picker row.
110+
public var displayValueForSecondRow: ((B) -> (String)) = { b in return String(describing: b) }
105111

106112
public var noValueDisplayText: String?
107113

@@ -140,6 +146,8 @@ public final class DoublePickerInlineRow<A, B> : _DoublePickerInlineRow<A, B>, R
140146
public func setupInlineRow(_ inlineRow: InlineRow) {
141147
inlineRow.firstOptions = firstOptions
142148
inlineRow.secondOptions = secondOptions
149+
inlineRow.displayValueForFirstRow = displayValueForFirstRow
150+
inlineRow.displayValueForSecondRow = displayValueForSecondRow
143151
inlineRow.displayValueFor = self.displayValueFor
144152
inlineRow.cell.height = { UITableView.automaticDimension }
145153
}

0 commit comments

Comments
 (0)