FUIValuePickerFormCell
@IBDesignable
@MainActor
open class FUIValuePickerFormCell : FUIInlineValidationTableViewCell, FUIPropertyFormCell, UIPickerViewDataSource, UIPickerViewDelegate
A customized UITableViewCell, which contains a UILabel, a UITextField and a UIPickerView. It allows users to select a single value from a set of options using a spinning wheel.

The developer should set the following properties on the cell, in their implementation of UITableViewDataSource cellForRow(at:) function:
keyName: The key name of the propertyvalueOptions: A set of options that users can chose from.value: The value of the property, asInt
And an onChangeHandler:
onChangeHandler: a handler closure, which is invoked on changes to the value.
Optionally, the developer may set
isEditable: Indicates if the cell’s value may be modified. Defaults totrue.
Color setting:
Setting text color of filter buttons for a state using setTintColor(_:for:) api. Currently .disabled, .normal and selected are supported.
cell.setTintColor(UIColor.red, for: .normal)
The following is an example of usage in an application UITableViewController:
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.register(FUIValuePickerFormCell, forCellReuseIdentifier: FUIValuePickerFormCell.reuseIdentifier)
// ...
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: FUIValuePickerFormCell.reuseIdentifier, for: indexPath) as! FUIValuePickerFormCell
cell.keyName = "Maximum Price"
cell.valueOptions = ["5", "10", "15", "20", "25"]
cell.value = 0
// MARK: implement an onChangeHandler
cell.onChangeHandler = { [weak self] newValue in
self.myObject.price = self.priceTitles[newValue].first!.key
}
return cell
}
Theming
Supported style classes
fdlFUIValuePickerFormCell
fdlFUIValuePickerFormCell_keyLabel
fdlFUIValuePickerFormCell_valueTextField
fdlFUIValuePickerFormCell_valueTextField_selected
-
The UILabel holds the key name string.
Declaration
Swift
@IBOutlet @MainActor public private(set) weak var keyLabel: UILabel! { get } -
The UITextField holds the selected value strings.
Declaration
Swift
@IBOutlet @MainActor public private(set) weak var valueTextField: UITextField! { get } -
The array of the valid options.
Declaration
Swift
@MainActor public var valueOptions: [String] { get set } -
The default cell reuse identifier.
Declaration
Swift
@MainActor open class var reuseIdentifier: String { get } -
The value type is
Int.Declaration
Swift
public typealias ValueType = Int -
The value of the cell.
Declaration
Swift
@MainActor public var value: Int { get set } -
Implementation of change handler. Is invoked on changes to the
valueproperty.Declaration
Swift
@MainActor public var onChangeHandler: ((Int) -> Void)? -
Indicates if the value of the cell may be modified. Default value is true.
Declaration
Swift
@MainActor public var isEditable: Bool { get set } -
Indicate whether the picker is enabled.
isEnabledandisEditableare in sync.Declaration
Swift
@MainActor override public var isEnabled: Bool { get set } -
Indicates whether the cell is a mandatory field.
The default value is
false.Declaration
Swift
@MainActor open var isRequired: Bool { get set } -
If
isTrackingLiveChangesis true, thenonChangeHandler, will be invoked whenever a value is selected.Otherwise,
onChangeHandlerwill be invoked only when the Value Picker is closed.The default value is
true.Declaration
Swift
@MainActor public var isTrackingLiveChanges: Bool -
This property indicates whether the picker is to always be displayed.
The default value is
false.Declaration
Swift
@MainActor open var alwaysShowPicker: Bool { get set } -
The key name of the cell.
Declaration
Swift
@IBInspectable @MainActor public var keyName: String? { get set } -
Indicates that the cell is a mandatory field.
The default value is
*.Declaration
Swift
@MainActor public var mandatoryIndicator: FUIText