FUIDurationPickerFormCell

@IBDesignable
@MainActor
public class FUIDurationPickerFormCell : FUIInlineValidationTableViewCell, FUIPropertyFormCell
extension FUIDurationPickerFormCell: UIPickerViewDataSource
extension FUIDurationPickerFormCell: UIPickerViewDelegate

A UITableViewCell subclass, which allows a user to read or enter a value, using a duration picker.

FUIDurationPickerFormCell

The developer should set the following properties on the cell, in their implementation of UITableViewDataSource cellForRow(at:) function:

  • keyName: The key name of the property
  • value: The value of the property, as TimeInterval

And an onChangeHandler:

  • onChangeHandler: a handler closure, which is invoked on changes to the value

Optionally, the developer may provide

  • minInterval: The minute interval to be used in the picker.
  • isEditable: Indicates if the cell’s value may be modified. Defaults to true.

Color configuration:

Call setTintColor(_:for:) to configure tint color for disabled, normal, selected UIControlState. Setting tintColor is equivalent to call setTintColor(color, for: UIControlState.normal).

  • disabled: Color to be used when control is disabled.
  • normal: Color to be used when control is enabled.
  • selected: Color to be used when control is selected.

The following is an example of usage in an application UITableViewController:

Important

The app’s UITableViewController must subclass FUIFormTableViewController
 override func viewDidLoad() {
     super.viewDidLoad()
     self.tableView.register(FUIDurationPickerFormCell, forCellReuseIdentifier: FUIDurationPickerFormCell.reuseIdentifier)
     // ...
 }

 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

     let cell = tableView.dequeueReusableCell(withIdentifier: FUIDurationPickerFormCell.reuseIdentifier, for: indexPath) as! FUIDurationPickerFormCell
     cell.keyName = "Duration"
     cell.value = myObject.eventDuration  // in seconds

     // MARK:  implement an onChangeHandler
     cell.onChangeHandler = { newValue in
        myObject.eventDuration = newValue
     }

     return cell
 }

## Theming Supported style classes

 fdlFUIDurationPickerFormCell
 fdlFUIDurationPickerFormCell_keyLabel
 fdlFUIDurationPickerFormCell_valueLabel
 fdlFUIDurationPickerFormCell_valueLabel_selected
  • The UILabel holds the key name string.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    public private(set) weak var keyLabel: UILabel! { get }
  • Indicates that the cell is a mandatory field.

    The default value is *.

    Declaration

    Swift

    @MainActor
    public var mandatoryIndicator: FUIText
  • The UILabel holds the selected value strings.

    Declaration

    Swift

    @IBOutlet
    @MainActor
    public private(set) weak var valueLabel: UILabel! { get }
  • The UIPickerView for this cell.

    This durationPicker will be displayed only when this cell is selected.

    Declaration

    Swift

    @objc
    @MainActor
    public private(set) lazy var durationPicker: UIPickerView { get set }
  • The default cell reuse identifier.

    Declaration

    Swift

    @MainActor
    open class var reuseIdentifier: String { get }
  • The value type is TimeInterval.

    Declaration

    Swift

    public typealias ValueType = TimeInterval
  • This property indicates if duration value of 0 is allowed or not.

    The default is false, which means that the duration value can not be 0.

    Declaration

    Swift

    @MainActor
    public var allowsZeroDuration: Bool { get set }
  • The default value is 0.0 Limit is 23:59 (86,399 seconds).

    Declaration

    Swift

    @MainActor
    public var value: TimeInterval { get set }
  • Implementation of change handler. Is invoked on changes to the value property.

    Declaration

    Swift

    @MainActor
    public var onChangeHandler: ((Double) -> Void)?
  • minuteInterval must be evenly divided into 60.

    Default is 5. minimum is 1, maximum is 30.

    Declaration

    Swift

    @MainActor
    public var minuteInterval: Int { get set }
  • Indicates if the value of the cell may be modified. The default is true.

    Declaration

    Swift

    @MainActor
    public var isEditable: 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 isTrackingLiveChanges is true, then onChangeHandler, will be invoked whenever a duration is selected.

    Otherwise, onChangeHandler will be invoked only when the Duration Picker is closed.

    The default value is true.

    Declaration

    Swift

    @MainActor
    public var isTrackingLiveChanges: Bool
  • The key name of the cell.

    Declaration

    Swift

    @IBInspectable
    @MainActor
    public var keyName: String? { get set }
  • Set this property to customize the format of duration text. If this property is not set, using the default text format. The default text format is “%d Hrs %d Min” where %d is the number of hours and minutes.

    Declaration

    Swift

    @MainActor
    public var durationTextFormat: String! { get set }
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func numberOfComponents(in pickerView: UIPickerView) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView
  • Undocumented

    Declaration

    Swift

    @MainActor
    public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)