FUIDurationPickerCollectionViewCell

open class FUIDurationPickerCollectionViewCell : FUIBaseDrawingCollectionViewCell<FUIDurationPickerContentView>

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

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

  • title: 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

  • minuteInterval: 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 UICollectionViewController:

Important

The app’s UICollectionController must subclass FUIFormCollectionViewController
 override func viewDidLoad() {
     super.viewDidLoad()
     self.collectionView.register(FUIDurationPickerCollectionViewCell, forCellReuseIdentifier: FUIDurationPickerCollectionViewCell.reuseIdentifier)
     // ...
 }

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

     let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUIDurationPickerCollectionViewCell.reuseIdentifier, for: indexPath) as! FUIDurationPickerCollectionViewCell
     cell.title.text = "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 default cell reuse identifier.

    Declaration

    Swift

    public override var reuseIdentifier: String? { get }
  • Indicates if the value of the cell may be modified. The default is true.

    Declaration

    Swift

    public var isEditable: Bool { get set }