FUIDatePickerCollectionViewCell

@MainActor
open class FUIDatePickerCollectionViewCell : FUIInlineValidationDrawingCollectionViewCell<FUIDatePickerContentView>

A UICollectionViewCell subclass that allows a user to read or enter a value, using a date picker.

And an onChangeHandler:

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

Optionally, UITableViewController could provide:

  • dateFormatter: A developer-defined UIDateFormatter for transposing between Date type and String.
  • datePickerMode: The UIDatePicker.Mode for the Date Picker. The default is .dateAndTime. Note that .countDownTimer mode is not supported. Use the FUIDurationPickerFormCell for duration values.

Example of usage in an application, UICollectionViewController:

Important

The app’s UICollectionViewController must subclass FUIFormCollectionViewController.
let dateFormatter = DateFormatter()
var date: Date?

override func viewDidLoad() {
super.viewDidLoad()

dateFormatter.dateFormat = "dd-MM-yyyy"
self.collectionView.register(FUIDatePickerCollectionViewCell.self, forCellWithReuseIdentifier: FUIDatePickerCollectionViewCell.reuseIdentifier)
// ...
}

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUIDatePickerCollectionViewCell.reuseIdentifier, for: indexPath) as! FUIDatePickerCollectionViewCell
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 TEXT class paths:

   fdlFUIDatePickerCollectionViewCell_title
   fdlFUIDatePickerCollectionViewCell_valueText {}

Supported TEXT properties:

   font-color: Color;
   font-style: UIFontTextStyle;

Supported TINTABLE class paths:

   fdlFUIDatePickerCollectionViewCell_valueText {}

Supported TINTABLE properties:

font-color { -selected }: Color;
font-style { -selected }: UIFontTextStyle;
  • The FUILabel that holds the key name string.

    Declaration

    Swift

    @MainActor
    public var keyLabel: FUILabel { get }
  • TheFUILabel that holds the value string.

    Declaration

    Swift

    @MainActor
    public var valueLabel: FUILabel { 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. isEnabled and isEditable are in sync.

    Declaration

    Swift

    @MainActor
    open override 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 }