FUINoteCollectionViewCell

@IBDesignable
@MainActor
open class FUINoteCollectionViewCell : FUIInlineValidationDrawingCollectionViewCell<FUINoteFormCellContentView>

The reusable UI component implemented as a UICollectionViewCell to allow users to enter notes.

FUINoteCollectionViewCell

The cell height is automatically adjusted to allow all of the content to be displayed. However, the cell height is also limited to the height of the screen above the soft keyboard height.

Usage

The following is an example of usage in an application with UIViewController and UICollectionViewDataSource:

override func viewDidLoad() {
    super.viewDidLoad()
    self.collectionView.register(FUINoteCollectionViewCell.self, forCellReuseIdentifier: FUINoteCollectionViewCell.reuseIdentifier)
}

override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UITableViewCell {
    let cell = self.collectionView.dequeueReusableCell(withReuseIdentifier: FUINoteCollectionViewCell.reuseIdentifier, for: indexPath) as! FUINoteCollectionViewCell
    cell.onChangeHandler = { [unowned self] newValue in
         self.noteText = newValue
    }
    cell.placeholder.text = "Enter Description"
    cell.value = noteText
    cell.isTrackingLiveChanges = true
    return cell
}

Theming

Supported TEXT class paths:

   fdlFUINoteFormCell_valueText {}
   fdlFUINoteFormCell_placeholder {}

Supported TEXT properties:

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

Supported TINTABLE class paths:

   fdlFUIKeyValueFormCell_valueText {}

Supported TINTABLE properties:

   tint-color { -disabled }: Color;
   font-style { -disabled }: UIFontTextStyle;
  • isEnabled and isEditable are in sync.

    Declaration

    Swift

    @MainActor
    open override var isEnabled: Bool { get set }
  • Indicates whether the note text can be modified or not. The default is true.

    Declaration

    Swift

    @MainActor
    public var isEditable: Bool { get set }
  • If isTrackingLiveChanges is true, then onChangeHandler will be invoked for every letter entered.

    Otherwise, onChangeHandler will be invoked only after the user taps the Done key, or the field resigns as first responder.

    The default value is false.

    Declaration

    Swift

    @MainActor
    public var isTrackingLiveChanges: Bool { get set }
  • If this is true, this FUINoteFormCell will grow in height and the cell will not be scrollable. Otherwise, the cell height will be fixed.

    Declaration

    Swift

    @available(*, deprecated, message: "This property is deprecated. Please use the 'maxNumberOfLines' property.")
    @MainActor
    public var isAutoFitting: Bool { get set }
  • The minimum number of lines for the valueTextView .

    The cell height will be set to display the text with at least this number of lines.

    The default and the hard minumum value is 2. Setting this value to less than the hard minimum will set this value to the hard minimum. This property is ignored when the height of the cell is fixed.

    Declaration

    Swift

    @MainActor
    public var minNumberOfLines: Int { get set }
  • The maximum number of lines in this FUINoteFormCell.

    The cell height can grow to display the text with this number of lines. This property is ignored when the height of the cell is fixed. The view will be scrollable when the text entered requires more lines to be displayed. The default is 0, which means no limit.

    Note that more text may be displayed in the view due to extra top and buttom margins of the text view in the cell.

    Declaration

    Swift

    @MainActor
    public var maxNumberOfLines: Int { get set }
  • This is the maximum length of the note text, if maxNoteTextLength is greater than 0.

    If the text length reaches this limit when isCharCountEnabled is false, the user cannot enter more text. Note: If the user pastes a string and the length plus the current text length is greater than the limit, the insert is rejected. Partial strings are not accepted in the text field.

    If the text length reaches this limit when isCharCountEnabled is true, the user cannot enter more text if allowsBeyondLimit is false. In the case where allowsBeyondLimit is true, the user can enter more text beyond the limitation in the error state.

    The default value for maxNoteTextLength is 0, which means no limit.

    Declaration

    Swift

    @MainActor
    public var maxNoteTextLength: Int { get set }
  • The UI component that holds the note text.

    Declaration

    Swift

    @MainActor
    public var valueTextView: FUITextView { get }
  • The FUIText that holds the text of the value.

    Use this property to customize the text color and font.

    Declaration

    Swift

    @MainActor
    public var valueText: FUIText { get }
  • The placeholder string to be put on the text area before the user has typed anything.

    Declaration

    Swift

    @available(*, deprecated, message: "This property is deprecated.  Please use `placeholder.text`.")
    @IBInspectable
    @MainActor
    public var placeholderText: String? { get set }
  • The hint text.

    Declaration

    Swift

    @MainActor
    open var hintText: String? { get set }
  • Indicates if the cell is read-only or not.

    The default value is false.

    Declaration

    Swift

    @MainActor
    open var isReadOnly: 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 }
  • Indicates whether to hide the read-only hint or not.

    A default hint is provided when this cell’s isReadOnly is true unless this property is true. The default is false, meaning that the default read-only hint will be shown when isReadOnly is true.

    Declaration

    Swift

    @MainActor
    open var hidesReadOnlyHint: Bool { get set }
  • The error message when the character count limitation is reached.

    Declaration

    Swift

    @MainActor
    public var charCountReachLimitMsg: String { get set }
  • The error message when the character count exceeds the limitation.

    Declaration

    Swift

    @MainActor
    public var charCountBeyondLimitMsg: String { get set }
  • Declaration

    Swift

    @MainActor
    public override var validationMessage: String? { get set }
  • Declaration

    Swift

    @MainActor
    public override var inlineValidationStyle: FUIInlineValidationStyle { get set }
  • Message type of FUIInlineValidationView.

    Declaration

    Swift

    @MainActor
    public override var inlineValidationType: FUIInlineValidationType { get set }
  • If isCharCountEnabled is true, it will show the character count and the maxNoteTextLength. The character count number will be updated during editing.

    The default value is false.

    Declaration

    Swift

    @MainActor
    public var isCharCountEnabled: Bool { get set }
  • If showsErrorInValidationMsg is true, it will show the character count error message in the validationMessage of the FUITextFieldFormCell. Otherwise, the error message will be shown in the errorView in the same layout as the hintView.

    The default is true.

    Declaration

    Swift

    @MainActor
    public var showsErrorInValidationMsg: Bool { get set }
  • If allowsBeyondLimit is true, it will allow the user to input continuously even after maxNoteTextLength is reached. It will be in an error state with an error message and a semantic negative color. If allowsBeyondLimit is false, it will auto-stop user input when maxNoteTextLength is reached.

    The default value is false.

    Declaration

    Swift

    @MainActor
    public var allowsBeyondLimit: Bool { get set }
  • The error text.

    Declaration

    Swift

    @MainActor
    open var errorText: String? { get set }
  • If hasError is true, it will be in an error state with an error message and a semantic negative color.

    The default value is false.

    Declaration

    Swift

    @MainActor
    public var hasError: Bool { get set }
  • A Bool that indicates whether there is a character counting error. When true, the input character count exceeds the maxTextLength.

    Declaration

    Swift

    @MainActor
    public var hasCharCountError: Bool { get }