FUIStepperCollectionViewCell
@MainActor
open class FUIStepperCollectionViewCell : FUIInlineValidationDrawingCollectionViewCell<FUIStepperView>, FUIFormCell
extension FUIStepperCollectionViewCell: FUITintAttributesProvider
The reusable UI component implemented as a UICollectionViewCell to display or be edited as a stepper.
A stepper is a visual representation of a user’s progress through a series of steps in a task, indicating how much the user has completed or how far they are from completing the task.
And an onChangeHandler:
onChangeHandler: a handler closure, which is invoked on changes to the value
Optionally, the developer may provide
hintText: hint text.isEditable: Indicates whether the cell’s value can be modified. The default istrue.maximumValue: The highest possible numeric value for the stepper. The default is 100.minimumValue: The lowest possible numeric value for the stepper. The default is 0.
The following is an example of usage in an application UICollectionViewController:
override func viewDidLoad() {
super.viewDidLoad()
self.collectionView.register(FUIStepperCollectionViewCell.self, forCellWithReuseIdentifier: FUIStepperCollectionViewCell.reuseIdentifier)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUIStepperCollectionViewCell.reuseIdentifier, for: indexPath) as! FUIStepperCollectionViewCell
cell.title = "Normal Stepper"
cell.value = "5"
cell.hintText = "hint text"
// MARK: implement onChangeHandler
cell.onChangeHandler = { newValue in
// ...
}
cell.maximumValue = 10
cell.minimumValue = 0
// custom colors and fonts
cell.setAttributes([.fuiBorderColor: UIColor.systemPurple], for: .title, state: .highlighted)
cell.setAttributes([.fuiBorderColor: UIColor.systemYellow], for: .title, state: .normal)
return cell
}
## Customize Style Using tintAttributes
Supported keyView:
setAttributes([.foregroundColor:, .font], for: .title, state: { .normal | .highlighted | .disabled })
or directly set textColor and font for the title.
Supported valueText:
setAttributes([.foregroundColor:, .font], for: .valueText, state: { .normal | .disabled })
addAttributes([.fuiBorderColor:], for: .valueText, state: { .normal | .highlighted | .disabled })
or directly set textColor and font for the valueTextField.
Supported increaseButton and decreaseButton:
setAttributes([.foregroundColor:], for: .icons, state: { .normal | .disabled })
Supported hintView:
setAttributes([.foregroundColor:, .font:], for: .subtitle, state: { .normal | .disabled })
### .nss Theme
Supported keyView:
fdlFUIStepperFormCell_keyText {
font-color { -highlighted | -disabled } (Color)
font-style { -highlighted | -disabled } (UIFont.TextStyle)
}
Supported valueText:
fdlFUIStepperFormCell_valueText {
font-color { -disabled } (Color)
font-style { -disabled } (UIFont.TextStyle)
border-color { -highlighted | -disabled } (Color)
}
Supported BUTTON class paths:
fdlFUIStepperFormCell_increaseButton {
font-color { -disabled } (Color)
}
fdlFUIStepperFormCell_decreaseButton {
font-color { -disabled } (Color)
}
Supported hintView:
fdlFUIStepperFormCell_hintText {
font-color { -disabled } (Color)
font-style { -disabled } (UIFont.TextStyle)
}
-
The name of the title.
Declaration
Swift
@MainActor open var title: String? { get set } -
The
FUITextFieldholds the value string.Declaration
Swift
@MainActor open var valueTextField: FUITextField { get } -
isEnabledandisEditableare in sync.Declaration
Swift
@MainActor public override var isEnabled: Bool { get set } -
If
isTrackingLiveChanges == true, thenonChangeHandlerwill 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.The default is
false.Declaration
Swift
@MainActor open var isTrackingLiveChanges: Bool { get set } -
The hint text.
Declaration
Swift
@MainActor open var hintText: String? { get set } -
The highest possible numeric value for the stepper. The default is 100.
Declaration
Swift
@MainActor open var maximumValue: Double { get set } -
The lowest possible numeric value for the stepper. The default is 0.
Declaration
Swift
@MainActor open var minimumValue: Double { get set } -
The step or increment value for the stepper. The default is 1, must be greater than 0.
Declaration
Swift
@MainActor open var stepValue: Double { get set } -
The numeric value of the stepper. The default is minimumValue.
Declaration
Swift
@MainActor public var value: Double { get set } -
Determine whether the
textFieldis editableDeclaration
Swift
@MainActor public var isEditable: Bool { get set } -
Implementation of the change handler. This is invoked when the
valueproperty changes.Declaration
Swift
@MainActor public var onChangeHandler: ((Double) -> Void)? { get set }
-
Declaration
Swift
@MainActor open override func prepareForReuse() -
Undocumented
Declaration
Swift
@MainActor open override func resignFirstResponder() -> Bool -
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