From 9ead011fcfc7b05a0e69134a00be96086a289133 Mon Sep 17 00:00:00 2001 From: Lili Shi Date: Fri, 26 May 2023 07:19:35 -0700 Subject: [PATCH] Add display options for first and second PickerInlineRow (#2246) --- Source/Rows/PickerInlineRow.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Rows/PickerInlineRow.swift b/Source/Rows/PickerInlineRow.swift index 818c47950..a86fb416e 100644 --- a/Source/Rows/PickerInlineRow.swift +++ b/Source/Rows/PickerInlineRow.swift @@ -102,6 +102,12 @@ open class _DoublePickerInlineRow : Row>>, No /// Options for second component given the selected value from the first component. Will be called often so should be O(1) public var secondOptions: ((A) -> [B]) = { _ in [] } + + /// Modify the displayed values for the first picker row. + public var displayValueForFirstRow: ((A) -> (String)) = { a in return String(describing: a) } + + /// Modify the displayed values for the second picker row. + public var displayValueForSecondRow: ((B) -> (String)) = { b in return String(describing: b) } public var noValueDisplayText: String? @@ -140,6 +146,8 @@ public final class DoublePickerInlineRow : _DoublePickerInlineRow, R public func setupInlineRow(_ inlineRow: InlineRow) { inlineRow.firstOptions = firstOptions inlineRow.secondOptions = secondOptions + inlineRow.displayValueForFirstRow = displayValueForFirstRow + inlineRow.displayValueForSecondRow = displayValueForSecondRow inlineRow.displayValueFor = self.displayValueFor inlineRow.cell.height = { UITableView.automaticDimension } }