FUIListPickerCollectionViewCell
@MainActor
open class FUIListPickerCollectionViewCell : FUIInlineValidationDrawingCollectionViewCell<FUIListPickerFormView>, FUIPickerFormCell
The reusable UI component implemented as a UICollectionViewCell to display a key-value pair property, which is integrated with a FUIListPicker controller for displaying a list of values.
title: The title of the property.valueText: The title of the property.value: The default selections.valueOptions: The list of optional values the user may choose from.allowsMultipleSelection: Indicates whether the user can select multiple values. The default istrue, meaning that, by default, the user may select multiple values.isEnabled: Determines whether the selection(s) can be modified or not. The default istrue.listPicker: TheFUIListPickerfor thisFUIListPickerCollectionViewCell.
Note that the display of the selections in the valueLabel is the
responsibility of the developer if the dataSource property of the listPicker
is set. The developer needs to set the text of the valueLabel to reflect the selections.
Otherwise, if the developer sets valueOptions and leaves dataSource of listPicker as nil,
then the text in valueLabel will be set internally.
Here are the code snippets in the app’s UICollectionViewController implementation:
(The app’s UICollectionViewController needs to be a subclass of FUIFormCollectionViewController.)
var propValue7: [Int] = [1, 3, 6]
var valueOptions7 = ["One", "Two", "Three", "Four", "Five", "Six", "Seven"]
var listPickerDataSource7 = StringListPickerDataSource(options: valueOptions7)
override func viewDidLoad() {
super.viewDidLoad()
self.collectionView.register(FUIListPickerCollectionViewCell.self, forCellWithReuseIdentifier: FUIListPickerCollectionViewCell.reuseIdentifier)
// ...
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUIListPickerCollectionViewCell.reuseIdentifier, for: indexPath) as! FUIListPickerCollectionViewCell
cell.title.text = "Choose Multiple"
cell.value = propValue7
cell.allowsMultipleSelection = true
cell.valueText.text = descriptionForSelectedStrings(valueOptions7, at: propValue7) // See below
cell.listPicker.dataSource = listPickerDataSource7
cell.listPicker.searchResultsUpdating = listPickerDataSource7
cell.listPicker.isSearchEnabled = true
cell.listPicker.prompt = "Please select multiple items"
cell.listPicker.searchBar?.isBarcodeScannerEnabled = true
cell.listPicker.searchBar?.barcodeScanner?.scanMode = .EAN_UPC
cell.listPicker.searchBar?.barcodeScanner?.scanResultTransformer = { (scanString) -> String in
return self.transformStringToSearchBar(scanResultString: scanString)
}
// MARK: implement onChangeHandler
cell.onChangeHandler = { [weak self] newValue in
self.propValue3 = newValue
}
return cell
}
func descriptionForSelectedStrings(_ options: [String], at indexes: [Int]) -> String {
return options.enumerated().filter({ (index, element) -> Bool in
return indexes.contains(index)
}).reduce ("") { string, element in
return string.isEmpty ? element.1 : "\(string), \(element.1)"
}
}
## Theming
Supported Text class paths:
fdlFUIListPickerCollectionViewCell_title {}
fdlFUIListPickerFormView_valueText {}
Supported Text attributes:
font-color (Color)
font-name (FontName)
font-style (UIFontTextStyle)
font-size (Number)
text-align (TextAlign)
text-line-clamp (Integer)
Supported UIView class paths:
fdlFUIListPickerCollectionViewCell_selectedBackgroundView {}
Supported UIView properties:
background-color: (Color)
-
The
FUILabelthat holds the key name string.Declaration
Swift
@MainActor public var keyLabel: FUILabelProxy { get } -
The
FUILabelthat holds the value string.Declaration
Swift
@MainActor public var valueLabel: FUILabelProxy { get } -
The value text for this property
Declaration
Swift
@MainActor public var valueText: FUIMultiLineText { get } -
The key name of the property.
Declaration
Swift
@MainActor public var keyName: String? { get set } -
The value type is String array.
Declaration
Swift
public typealias ValueType = [Int] -
The value is the selected indexes to the items in the list. This property is not used when
ListPicker‘sisDataSourceRequiringUniqueIdentifiersis true.Declaration
Swift
@MainActor public var value: [Int] { get set } -
Indicates whether this cell is enabled or not, that is, whether the selections can be changed or not. The default is
true.Declaration
Swift
@MainActor public override var isEnabled: Bool { get set } -
isEditableandisEnabledare in sync.Declaration
Swift
@MainActor public var isEditable: Bool { get set } -
This property specifies whether the
valueLabelshould always be below thekeyLabelor not.The default is
false.Declaration
Swift
@MainActor public var alwaysShowValueTextOnBottom: Bool { get set } -
Implementation of the change handler. This is invoked on changes to the
valueproperty.Declaration
Swift
@MainActor public var onChangeHandler: (([Int]) -> Void)? { get set } -
If the
ListPicker‘sisDataSourceRequiringUniqueIdentifiersistrue, then this is the handler to be invoked whenuuidValueschanges.Declaration
Swift
@MainActor public var onUuidChangeHandler: (([String]) -> Void)? -
The array of the valid options.
Declaration
Swift
@MainActor public var valueOptions: [String] { get set } -
If the
ListPicker‘sisDataSourceRequiringUniqueIdentifiersistrue, this property is the selected UUID strings.Declaration
Swift
@MainActor public var uuidValues: [String] -
If
isTrackingLiveChangesistrue, thenonChangeHandleroronUuidChangeHandlerwill be invoked for every selection and de-selection.Otherwise, the handler will be invoked only after the
FUIListPickeris dismissed.Note that
isTrackingLiveChangesis treated asfalseifisUndoEnabledistrue.The default is
false.Declaration
Swift
@MainActor public var isTrackingLiveChanges: Bool -
If this property is true, the Cancel button will be displayed on the right side of the navigation bar to allow the user to undo the change when tapped.
The default is
false(the Cancel button will not be displayed).Declaration
Swift
@MainActor public var isUndoEnabled: Bool -
The
FUIListPickerfor thisFUIListPickerFormCell.Declaration
Swift
@MainActor public var listPicker: FUIListPicker { get set } -
Indicates whether the user can select multiple values.
The default is
true, meaning that, by default, the user can select multiple values.Declaration
Swift
@MainActor public var allowsMultipleSelection: Bool { get set } -
Indicates whether empty selection is allowed.
The default is
true, meaning that, by default, the user does not need to select an item.Declaration
Swift
@MainActor public var allowsEmptySelection: Bool -
Specifies whether the picker is to be dismissed after selection.
If this property is
trueandallowsMultipleSelectionisfalse, the picker will be dismissed after the user makes a selection. The default isfalse.Declaration
Swift
@MainActor public var isPickerDismissedOnSelection: Bool -
This property indicates whether the list picker should be presented modally or not. The default is
false.Declaration
Swift
@MainActor public var presentsListPickerModally: Bool -
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 } -
This is the developer implementation of the handler when the scan button is tapped.
If the value is set to nil, the default barcode scanner will be used.
Declaration
Swift
@MainActor public var customScanHandler: ((UISearchBar) -> Void)? { get set } -
The
FUIListPickerTableViewControllerassociated with thisFUIListPickerCollectionViewCell.Declaration
Swift
@MainActor public private(set) var listPickerTableViewController: FUIListPickerTableViewController! { get } -
Undocumented
Declaration
Swift
@MainActor open override var isSelected: Bool { get set } -
Declaration
Swift
@MainActor open override func layoutSubviews()