FUIDatePickerFormCell
@IBDesignable
@MainActor
open class FUIDatePickerFormCell : FUIInlineValidationTableViewCell, FUIPropertyFormCell
A UITableViewCell subclass, which allows a user to read or enter a value, using a date picker.

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, asDate
And an onChangeHandler:
onChangeHandler: a handler closure, which is invoked on changes to the value
Optionally, UITableViewController could provide
dateFormatter: A developer-definedUIDateFormatter, for transposing betweenDatetype andString.datePickerMode: TheUIDatePickerModefor the date picker. Default is.dateAndTime. Note that.countDownTimermode is not supported. Use theFUIDurationPickerFormCellfor duration values.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:
let dateFormatter = DateFormatter()
var date: Date?
override func viewDidLoad() {
super.viewDidLoad()
dateFormatter.dateFormat = "dd-MM-yyyy"
self.tableView.register(FUIDatePickerFormCell.self, forCellReuseIdentifier: FUIDatePickerFormCell.reuseIdentifier)
// ...
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: FUIDatePickerFormCell.reuseIdentifier, for: indexPath) as! FUIDatePickerFormCell
cell.keyName = "End Date"
cell.dateFormatter = dateFormatter
cell.datePickerMode = .date
cell.value = self.date
// MARK: implement onChangeHandler
cell.onChangeHandler = { [unowned self] newValue in
self.date = newValue
}
return cell
}
Theming
Supported style classes
fdlFUIDatePickerFormCell
fdlFUIDatePickerFormCell_keyLabel
fdlFUIDatePickerFormCell_valueLabel
fdlFUIDatePickerFormCell_selectedBackgroundView
fdlFUIDatePickerFormCell_valueLabel_selected
-
The value type is Date.
Declaration
Swift
public typealias ValueType = Date? -
The value of the property.
Declaration
Swift
@MainActor open var value: Date? { get set } -
Implementation of change handler. Is invoked on changes to the
valueproperty.Declaration
Swift
@MainActor public var onChangeHandler: ((Date?) -> Void)? -
The default cell reuse identifier.
Declaration
Swift
@MainActor open class var reuseIdentifier: String { get } -
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? -
The UILabel that 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 that holds the value string.
Declaration
Swift
@IBOutlet @MainActor open private(set) weak var valueLabel: UILabel! { get } -
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.
isEnabledandisEditableare 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 } -
The key name of the property.
Declaration
Swift
@IBInspectable @MainActor open var keyName: String? { get set } -
The
DateFormatterto be used to display the selectedDate. Default formatter:- for
UIDatePickerMode.dateAndTimeit is medium date style followed by short time style. - for
UIDatePickerMode.dateit is medium date style - for
UIDatePickerMode.timeit is short time style
Declaration
Swift
@MainActor open var dateFormatter: DateFormatter? { get set } - for
-
If
isTrackingLiveChangesis true, thenonChangeHandler, will be invoked whenever a date is selected.Otherwise,
onChangeHandlerwill be invoked only when the Date Picker is closed.The default value is
true.Declaration
Swift
@MainActor open var isTrackingLiveChanges: Bool -
The
UIDatePickerModefor theUIDatePickerfor this cell. The default value isUIDatePickerMode.dateAndTime.Important
important :UIDatePickerMode.countDownTimeris not allowed here. UseFUIDurationPickerFormCellfor count down mode.Declaration
Swift
@MainActor open var datePickerMode: UIDatePicker.Mode { get set } -
The
UIDatePickerfor this cell. It will be displayed only when this cell is selected.Declaration
Swift
@objc @MainActor public private(set) lazy var datePicker: UIDatePicker { get set }
-
Undocumented
Declaration
Swift
@MainActor open override var accessibilityLabel: String? { get set } -
Undocumented
Declaration
Swift
@MainActor open override var accessibilityValue: String? { get set } -
Undocumented
Declaration
Swift
@MainActor open override var accessibilityHint: String? { get set }