FUITitleFormCollectionViewCell

open class FUITitleFormCollectionViewCell : FUIInlineValidationDrawingCollectionViewCell<FUITitleFormView>
extension FUITitleFormCollectionViewCell: FUITintAttributesProvider

The reusable UI component implemented as a UICollectionViewCell, allowing the user to enter a value using a UITextField.

  • value: The value of the property, as String

And an onChangeHandler:

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

Optionally, the developer may provide:

  • isEditable: Indicates whether the cell’s value may be modified. The default is true.

Color settings:

Setting tintColor for valueTextField for a state using the setTintColor(_:for:) API. Currently disabled and normal are supported.

 cell.setAttributes([.foregroundColor: UIColor.red], for: .valueText, state: .normal)

Remark

The font-color attribute will be overridden by the tint-color-disabled attribute when the cell is switched to the disabled state. Do not set textColor for valueTextField when the cell is in the disabled state.

Example of usage in an application, UICollectionViewController:

Important

The app’s UICollectionViewController must subclass FUIFormCollectionViewController.
override func viewDidLoad() {
   super.viewDidLoad()
   self.collectionView.register(FUITitleFormCollectionViewCell.self, forCellWithReuseIdentifier: FUITitleFormCollectionViewCell.reuseIdentifier)
   // ...
}

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
   let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUITitleFormCollectionViewCell.reuseIdentifier, for: indexPath) as! FUITitleFormCollectionViewCell

   cell.placeholderText = placeHolderText
   cell.value = myObject.title
   cell.isEditable = true

   // MARK:  implement onChangeHandler
   cell.onChangeHandler = { newValue in
        myObject.title = newValue
   }
   return cell
}

## Theming

Supported TableViewCell class paths:

 fdlFUITitleFormCell {}

Supported TableViewCell attributes:

 background-color (Color)
 background-color-disabled (Color)
 background-color-readonly (Color)

Supported TextField class paths:

 fdlFUITitleFormCell_valueTextField

Supported TextField properties:

 font-color: Color;
 font-color-disabled: Color;
 font-color-readonly: Color;
 placeholder-color: Color;
 font-style: UIFontTextStyle;
 font-style-disabled: UIFontTextStyle;
 font-style-readonly: UIFontTextStyle;