Skip to content

Commit

Permalink
Add display options for first and second PickerInlineRow (#2246)
Browse files Browse the repository at this point in the history
  • Loading branch information
lilidotshi authored May 26, 2023
1 parent c255e4b commit 9ead011
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Source/Rows/PickerInlineRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ open class _DoublePickerInlineRow<A, B> : Row<PickerInlineCell<Tuple<A, B>>>, 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?

Expand Down Expand Up @@ -140,6 +146,8 @@ public final class DoublePickerInlineRow<A, B> : _DoublePickerInlineRow<A, B>, 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 }
}
Expand Down

0 comments on commit 9ead011

Please sign in to comment.