FUIContactCell

FUIContactCell is a variant of UITableViewCell defined in SAPFiori. It contains a UIImageView, several UILabels, and a FUIActivityControl component.

It supports three activity items by default. You can change this by setting maxVisibleItems on the activityControl property.

Contact Cell

Code usage:


 //Create a FUIContactCell in a TableView
 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
     let cell = tableView.dequeueReusableCell(withIdentifier: FUIContactCell.reuseIdentifier) as! FUIContactCell
     let activities: [ActivityItem] = [ActivityItem.phone, ActivityItem.message]
     let contact = DataSource.contact[indexPath.row]
     cell.detailImage = contact.image
 // To enable a default gradient layer behind the placeholder text.
      cell.detailImageView.isGradientLayerEnabled = true
 // Set placeholder text.
     cell.detailImageView.placeholder.text = "This is a placeholder"
     cell.headlineText = contact.name
     cell.subheadlineText = contact.title
     cell.descriptionText = contact.address
     cell.activityControl.addActivities(activities)

 // Optionally, adjust activity item size (defaults to `CGSize(width: 25.0, height: 25.0)`)
     self.activityControl.itemSize = CGSize(width: 25, height: 25)
 // Optionally, adjust limit on visible items in activity control (defaults to `3`)
     self.activityControl.maxVisibleItems = 3
 // Optionally, adjust activity control spacing (defaults to `29.0`)
     self.activityControl.stackView.spacing = 29.0

 // Implement onActivitySelectedHandler.
    cell.onActivitySelectedHandler = { activityItem in

        switch activityItem {
        case ActivityItem.phone:
            let _ = contact.call()
        case ActivityItem.message:
            let _ = contact.sendMessage()
        case ActivityItem.videoCall:
            let _ = contact.video()
        default:
            break
        }
    }
 }

## Theming Supported style classes

 fdlFUIContactCell
 fdlFUIContactCell_headlineLabel
 fdlFUIContactCell_subheadlineLabel
 fdlFUIContactCell_descriptionLabel
  • Reuse identifier

    Declaration

    Swift

    open class var reuseIdentifier: String { get }
  • The FUIImageView holds a detail image.

    Declaration

    Swift

    @IBOutlet
    public private(set) var detailImageView: FUIImageView! { get }
  • The UILabel holds headline text.

    Declaration

    Swift

    @IBOutlet
    public private(set) weak var headlineLabel: FUILabel! { get }
  • The UILabel holds subheadline text.

    Declaration

    Swift

    @IBOutlet
    public private(set) weak var subheadlineLabel: FUILabel! { get }
  • The UILabel holds description text.

    Declaration

    Swift

    @IBOutlet
    public private(set) var descriptionLabel: FUILabel! { get }
  • The FUIActivityControl object used in ContactCell.

    Declaration

    Swift

    @IBOutlet
    public private(set) var activityControl: FUIActivityControl! { get }
  • Optional handler closure for ActivityItem selection.

     cell.onActivitySelectedHandler = { [weak contact] activityItem in
    
         switch activityItem {
            case ActivityItem.phone:
                let _ = contact?.call()
            case ActivityItem.message:
                let _ = contact?.sendMessage()
            case ActivityItem.videoCall:
                let _ = contact?.video()
            default:
                break
        }
    }
    

    Declaration

    Swift

    open var onActivitySelectedHandler: ((FUIActivityItem) -> Void)?
  • The default main stack right edge is set at the midpoint of the cell’s readable width, minus 8px. Set this to be a fraction between 0.01 and 0.99 to move the right edge of the mainStack relative to the cell readable width.

    Important

    the percentage of readable width includes areas often containing other subviews. So, a valid value is typically between 30% and 70%.

    Only used when horizontalSizeClass of the object cell is .regular.

    Declaration

    Swift

    public var splitPercent: CGFloat { get set }
  • Declaration

    Swift

    open func activityControl(_ activityControl: FUIActivityControl, didSelectActivity activityItem: FUIActivityItem)
  • Property to preserve detailImageView spacing. When it’s set to true, spacing is preserved for detailImageView even when there’s no image added to the image view.

    Declaration

    Swift

    public var preserveDetailImageSpacing: Bool { get set }
  • Text of headline label.

    Declaration

    Swift

    @IBInspectable
    public var headlineText: String? { get set }
  • Text of subheadline label.

    Declaration

    Swift

    @IBInspectable
    public var subheadlineText: String? { get set }
  • Text of descriptionLabel.

    Declaration

    Swift

    @IBInspectable
    public var descriptionText: String? { get set }
  • Image of ContactCell.

    Declaration

    Swift

    @IBInspectable
    public var detailImage: UIImage? { get set }
  • Text of tags for IB display purposes only

    Declaration

    Swift

    @IBInspectable
    public var ibDisplayActivityControl: String? { get set }