FUIDateRangePickerFormCell

@MainActor
open class FUIDateRangePickerFormCell : FUIInlineValidationDrawingTableViewCell<FUIDateRangePickerContentView>, FUIFormCell

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

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

  • title: The title of the property.
  • value: The value of the property, as DateRange

And an onChangeHandler:

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

Optionally, UITableViewController could provide

  • dateFormatter: A developer-defined UIDateFormatter, for transposing between Date type and String.
  • isEditable: Indicates if the cell’s value may be modified. Defaults to true.

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:

Important

The app’s UITableViewController must subclass FUIFormTableViewController

var dateRange1: FUIDateRange? = FUIDateRange(startDate: Date(), duration: 1)
let dateFormatter = DateFormatter()

override func viewDidLoad() {
    super.viewDidLoad()

    dateFormatter.dateFormat = "dd-MM-yyyy"
    self.tableView.register(FUIDateRangePickerFormCell.self, forCellReuseIdentifier: FUIDateRangePickerFormCell.reuseIdentifier)
    // ...
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: FUIDateRangePickerFormCell.reuseIdentifier, for: indexPath) as! FUIDateRangePickerFormCell
    cell.title.text = "Customized Date Formatter"

    cell.dateFormatter = dateFormatter
    cell.value = dateRange1

    // MARK:  implement onChangeHandler
    cell.onChangeHandler = { [unowned self] newValue in
        self.dateRange1 = newValue
    }

    return cell
}

Theming

Supported style classes

fdlFUIDateRangePickerFormCell_title
fdlFUIDateRangePickerFormCell_mandatoryIndicator
fdlFUIDateRangePickerFormCell_valueText
  • The value type is DateRange.

    Declaration

    Swift

    public typealias ValueType = FUIDateRange?
  • Implementation of change handler. Is invoked on changes to the value property.

    Declaration

    Swift

    @MainActor
    public var onChangeHandler: ((FUIDateRange?) -> Void)? { get set }
  • The text to be displayed when no date is selected.

    The default value is the localized string “No date selected”.

    Declaration

    Swift

    @MainActor
    public var noDateSelectedString: String? { get set }
  • The value of the property.

    Declaration

    Swift

    @MainActor
    open var value: FUIDateRange? { get set }
  • Indicates if the value of the cell could be changed or not. The default is true.

    Declaration

    Swift

    @MainActor
    open var isEditable: Bool { get set }
  • Indicate whether the slider is enabled. isEnabled and isEditable are in sync.

    Declaration

    Swift

    @MainActor
    override open 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 }
  • Indicates that the cell is a mandatory field.

    The default value is *.

    Declaration

    Swift

    @MainActor
    public var mandatoryIndicator: FUIText { get set }
  • The DateFormatter to be used to display the selected DateRange. Default date formatter conforms system setting.

    Declaration

    Swift

    @MainActor
    open var dateFormatter: DateFormatter? { get set }
  • The start date of the calendar. Default is current year’s first day.

    Declaration

    Swift

    @MainActor
    open var minimumDate: Date? { get set }
  • The end date of the calendar. Default is next year’s last day.

    Declaration

    Swift

    @MainActor
    open var maximumDate: Date? { get set }
  • The ID of the language to be used when displaying the FUICalendarView.

    The default value for this property is ‘nil’. The current device language will be used if this property is ‘nil’ or if the language ID is not supported by SAPFiori.

    Declaration

    Swift

    @MainActor
    public var customLanguageID: String? { get set }
  • Undocumented

    Declaration

    Swift

    @MainActor
    open override var accessibilityLabel: String? { get set }