FUIKeyValueCollectionViewCell
@MainActor
open class FUIKeyValueCollectionViewCell : NibDesignableFUIBaseCollectionViewCell
FUIKeyValueCollectionViewCell is a variant of UICollectionViewCell
defined in SAPFiori
. It contains a UILabel
and a UITextField
.
Code usage:
Register FUIKeyValueCollectionViewCell
for a collection view object.
self.collectionView.register(FUIKeyValueCollectionViewCell.self, forCellWithReuseIdentifier: FUIKeyValueCollectionViewCell.reuseIdentifier)
Implement collection view’s dataSource method collectionView(_:cellForItemAt:)
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = self.collectionView.dequeueReusableCell(withReuseIdentifier: FUIKeyValueCollectionViewCell.reuseIdentifier, for: indexPath) as! FUIKeyValueCollectionViewCell
switch indexPath.item {
case 0:
cell.keyName = "Name"
cell.value = "Broken Plates on Pole"
case 1:
cell.keyName = "Sort No."
cell.value = "0001"
default:
break
}
return cell
}
-
The UILabel holds the key string.
Declaration
Swift
@MainActor public weak var keyLabel: UILabel! { get }
-
The
UITextView
holds the value string.Declaration
Swift
@MainActor public weak var valueTextView: UITextView! { get }
-
The key name of the cell.
Declaration
Swift
@IBInspectable @MainActor public var keyName: String? { get set }
-
The value of the cell.
Declaration
Swift
@IBInspectable @MainActor public var value: String? { get set }