FUIContactCell

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

FUIContactCell

Code usage:

 //Developer needs to define MyContactObject and DataSource first.

//Contact object mockup class MyContactObject { var name: String var title: String var address: String var image: UIImage init(name: String, title: String, address: String, image: UIImage) { self.name = name self.title = title self.address = address self.image = image }   func call(){ // dial the phone number } func sendMessage(){ // locate assistant contact info & email } }


 //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
     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

    <span class="k">switch</span> <span class="n">activityItem</span> <span class="p">{</span>
    <span class="k">case</span> <span class="kt">ActivityItem</span><span class="o">.</span><span class="nv">phone</span><span class="p">:</span>
        <span class="k">let</span> <span class="nv">_</span> <span class="o">=</span> <span class="n">contact</span><span class="o">.</span><span class="nf">call</span><span class="p">()</span>
    <span class="k">case</span> <span class="kt">ActivityItem</span><span class="o">.</span><span class="nv">message</span><span class="p">:</span>
        <span class="k">let</span> <span class="nv">_</span> <span class="o">=</span> <span class="n">contact</span><span class="o">.</span><span class="nf">sendMessage</span><span class="p">()</span>
    <span class="k">case</span> <span class="kt">ActivityItem</span><span class="o">.</span><span class="nv">videoCall</span><span class="p">:</span>
        <span class="k">let</span> <span class="nv">_</span> <span class="o">=</span> <span class="n">contact</span><span class="o">.</span><span class="nf">video</span><span class="p">()</span>
    <span class="k">default</span><span class="p">:</span>
        <span class="k">break</span>
    <span class="p">}</span>
<span class="p">}</span>

}

  • Reuse identifier

    Declaration

    Swift

    open static var reuseIdentifier: String
  • The FUIImageView holds a detail image.

    Declaration

    Swift

    @IBOutlet open var detailImageView: FUIImageView!
  • The UILabel holds headline text.

    Declaration

    Swift

    @IBOutlet open weak var headlineLabel: UILabel!
  • The UILabel holds subheadline text.

    Declaration

    Swift

    @IBOutlet open weak var subheadlineLabel: UILabel!
  • The UILabel holds description text.

    Declaration

    Swift

    @IBOutlet open weak var descriptionLabel: UILabel!
  • The FUIActivityControl object used in ContactCell.

    Declaration

    Swift

    @IBOutlet open weak var activityControl: FUIActivityControl!
  • Optional delegate for ContactCell. Provides a method for handling ActivityItem selection.

    Important

    Should not be used, when the onActivitySelectedHandler property is set, and vis versa.

    Declaration

    Swift

    public weak var delegate: FUIContactCellDelegate?
  • Optional handler closure for ActivityItem selection.

    Important

    Should not be used, when the delegate property is set, and vis versa.
     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
        }
    }
    

    Declaration

    Swift

    open var onActivitySelectedHandler: ((FUIActivityItem) -> Void)?
  • Default main stack right edge is set at midpoint of cell’s readable width, minus 8px. Set to 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 area 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

    open var splitPercent: CGFloat
  • Image of ContactCell.

    Declaration

    Swift

    open var detailImage: UIImage?
  • 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

    open var preserveDetailImageSpacing: Bool = false
  • Text of headline label.

    Declaration

    Swift

    open var headlineText: String?
  • Text of subheadline label.

    Declaration

    Swift

    open var subheadlineText: String?
  • Text of descriptionLabel.

    Declaration

    Swift

    open var descriptionText: String?