FUIKeyValueCollectionViewCell

public class FUIKeyValueCollectionViewCell: NibDesignableCollectionViewCell

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

    public weak var keyLabel: UILabel!
  • The UITextFiled holds the value string.

    Declaration

    Swift

    public weak var valueTextField: UITextField!
  • Reuse identifier

    Declaration

    Swift

    open static var reuseIdentifier: String
  • The key name of the cell.

    Declaration

    Swift

    public var keyName: String?
  • The value of the cell.

    Declaration

    Swift

    public var value: String?