FUIStepperCollectionViewCell
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
open var title: String? { get set }
-
The
FUITextField
holds the value string.Declaration
Swift
open var valueTextField: FUITextField { get }
-
isEnabled
andisEditable
are in sync.Declaration
Swift
public var isEnabled: Bool { get set }
-
If
isTrackingLiveChanges == true
, thenonChangeHandler
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 is
false
.Declaration
Swift
open var isTrackingLiveChanges: Bool { get set }
-
The hint text.
Declaration
Swift
open var hintText: String? { get set }
-
The highest possible numeric value for the stepper. The default is 100.
Declaration
Swift
open var maximumValue: Double { get set }
-
The lowest possible numeric value for the stepper. The default is 0.
Declaration
Swift
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
open var stepValue: Double { get set }
-
The numeric value of the stepper. The default is minimumValue.
Declaration
Swift
public var value: Double { get set }
-
Determine whether the
textField
is editableDeclaration
Swift
public var isEditable: Bool { get set }
-
Implementation of the change handler. This is invoked when the
value
property changes.Declaration
Swift
public var onChangeHandler: ((Double) -> Void)? { get set }
-
Declaration
Swift
open override func prepareForReuse()
-
Undocumented
Declaration
Swift
open override func resignFirstResponder() -> Bool
-
Declaration
Swift
public var tintAttributes: [FUIPropertyRef : [FUIControlState : [NSAttributedStringKey : Any]]] { get set }
-
Declaration
Swift
public var tintState: FUIControlState { get set }
-
Declaration
Swift
public func tintAttributes(for property: FUIPropertyRef) -> [NSAttributedStringKey : Any]
-
Declaration
Swift
public func tintAttributes(for property: FUIPropertyRef, state: TintState) -> [NSAttributedStringKey : Any]
-
Declaration
Swift
public func styleSheetTintAttributes(for property: FUIPropertyRef) -> [NSAttributedStringKey : Any]
-
Declaration
Swift
public func styleSheetTintAttributes(for property: FUIPropertyRef, state: TintState) -> [NSAttributedStringKey : Any]
-
Declaration
Swift
public typealias TintState = FUIControlState