FUITitleFormCollectionViewCell
@MainActor
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, asString
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 istrue.
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
Thefont-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:
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;
-
The default cell reuse identifier.
Declaration
Swift
@MainActor open override class var reuseIdentifier: String { get } -
The
FUITextFieldholds the value string.Declaration
Swift
@MainActor public var valueTextField: FUITextField { get } -
The value for
FUITitleFormCollectionViewCellis the text of the Title.Declaration
Swift
@MainActor public var value: String { get set } -
Indicates whether the cell is read-only or not. The default is
false.Declaration
Swift
@MainActor public var isReadOnly: Bool { get set } -
Implementation of the change handler. This is invoked on changes to the
valueproperty.Declaration
Swift
@MainActor public var onChangeHandler: ((String) -> Void)? { get set } -
Indicates whether this title is editable or not. The default is true.
Declaration
Swift
@MainActor public var isEditable: Bool { get set } -
isEnabledandisEditableare in sync.Declaration
Swift
@MainActor public override var isEnabled: Bool { get set } -
The maximum length of the title text.
Declaration
Swift
@MainActor public var maxTitleTextLength: Int { get set } -
The type of the keyboard being used when the cell is in input mode.
Declaration
Swift
@MainActor public var keyboardType: UIKeyboardType { get set } -
If
isTrackingLiveChanges == true, thendidChangeValuefunction ofonChangeHandler, will be invoked for every letter entered.Otherwise,
onChangeHandlerwill be invoked only after the user taps the Done key, or the field resigns as first responder.Declaration
Swift
@MainActor public var isTrackingLiveChanges: Bool { get set } -
The placeholder text for the title text field.
Declaration
Swift
@MainActor public var placeholderText: String? { get set } -
Declaration
Swift
@MainActor public var tintAttributes: [FUIPropertyRef : [FUIControlState : [NSAttributedStringKey : Any]]] { get set } -
Declaration
Swift
@MainActor public var tintState: FUIControlState { get set } -
Declaration
Swift
@MainActor public func tintAttributes(for property: FUIPropertyRef) -> [NSAttributedStringKey : Any] -
Declaration
Swift
@MainActor public func tintAttributes(for property: FUIPropertyRef, state: TintState) -> [NSAttributedStringKey : Any] -
Declaration
Swift
@MainActor public func styleSheetTintAttributes(for property: FUIPropertyRef) -> [NSAttributedStringKey : Any] -
Declaration
Swift
@MainActor public func styleSheetTintAttributes(for property: FUIPropertyRef, state: TintState) -> [NSAttributedStringKey : Any] -
Declaration
Swift
public typealias TintState = FUIControlState