FUISliderFormCell
@IBDesignable
@MainActor
open class FUISliderFormCell : FUIInlineValidationTableViewCell, FUIPropertyFormCell
A customized UITableViewCell, which contains a UILabel, a UITextField and a UISlider. It allows users to select a single value from a continuous range of values.

The developer should set the following properties on the cell, in their implementation of UITableViewDataSource cellForRow(at:) function:
keyName: The key name of the propertyvalue: The value of the property, asFloatminimumValue: The minimum value of the selection range.maximumValue: The maximum value of the selection range.
And an onChangeHandler:
onChangeHandler: a handler closure, which is invoked on changes to the value.
Optionally, the developer may set:
unit: The unit of value. Default ismi.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 and .normal 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(FUISliderFormCell, forCellReuseIdentifier: FUISliderFormCell.reuseIdentifier)
// ...
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: FUISliderFormCell.reuseIdentifier, for: indexPath) as! FUISliderFormCell
cell.keyName = "Distance"
cell.minimumValue = 0
cell.maximumValue = 30
cell.value = myObject.distance
// MARK: implement an onChangeHandler
cell.onChangeHandler = { [weak self] newValue in
self.myObject.distance = newValue
}
return cell
}
Theming
Supported style classes
fdlFUISliderFormCell
fdlFUISliderFormCell_keyLabel
fdlFUISliderFormCell_valueTextField
-
The default cell reuse identifier.
Declaration
Swift
@MainActor open class var reuseIdentifier: String { get } -
The value type is Float.
Declaration
Swift
public typealias ValueType = Float -
The value of the property.
Declaration
Swift
@IBInspectable @MainActor public var value: Float { get set } -
Implementation of change handler. Is invoked on changes to the
valueproperty.Declaration
Swift
@MainActor public var onChangeHandler: ((Float) -> Void)? -
Indicate whether the user can change the value for slider. It is set to true by default.
Declaration
Swift
@MainActor public var isEditable: Bool { get set } -
Indicate whether the slider is enabled.
isEnabledandisEditableare in sync.Declaration
Swift
@MainActor override public var isEnabled: Bool { get set } -
The key name of the property.
Declaration
Swift
@IBInspectable @MainActor public var keyName: String? { get set } -
The unit of measure for value. Default value is
UnitLength.miles.Declaration
Swift
@MainActor public var unit: Unit { get set } -
The formatter to format the presentation of unit.
Declaration
Swift
@MainActor public let formatter: MeasurementFormatter -
The
UILabelholds the key name string.Declaration
Swift
@IBOutlet @MainActor public private(set) weak var keyLabel: UILabel! { get } -
The
UITextFieldholds the value string.Declaration
Swift
@IBOutlet @MainActor public private(set) weak var valueTextField: UITextField! { get } -
The
UISliderof the cell.Declaration
Swift
@IBOutlet @MainActor public private(set) weak var slider: UISlider! { get } -
The maximum value of the slider.
Declaration
Swift
@MainActor public var maximumValue: Float { get set } -
The minimum value of the slider.
Declaration
Swift
@MainActor public var minimumValue: Float { get set }
-
Undocumented
Declaration
Swift
@MainActor open override var isAccessibilityElement: Bool { get set } -
Undocumented
Declaration
Swift
@MainActor open override var accessibilityTraits: UIAccessibilityTraits { get set }