Skip to content

Object Floorplan


open class FUIObjectFloorplan<Entity: Hashable & Identifiable>: UITableViewController, UICollectionViewDataSource, UICollectionViewDelegate

A generic UITableViewController subclass for displaying different properties of a business object.

Floorplan Structure

  • On the top of view is FUIObjectHeader (optional)
  • Under the header, any number of FUIObjectSection can be added. There are two types of sections are supported: -- FUIObjectListSection: A section to show a list of UITableViewCell or its variants. -- FUIObjectCollectionSection: A section to show a collection of UICollectionViewCell or its variants. Default collection view layout used is FUICollectionViewLayout.horizontalScrollDynamicSize. Developer can set their own layout object if needed.


Data Binding

// Closure for object header data binding
let objectHeaderBinding: ((Product, FUIObjectHeader) -> Void)? = { _, objectHeader in
    objectHeader.headlineText = "Three Phase Pad Mounted Transformer (533423)"
    objectHeader.subheadlineText = "Electric Asset 533423"
    objectHeader.bodyText = "Three Phase Pad Mounted Transformer (533423)"
    objectHeader.footnoteText = "Temperature sensor predicts overheating failure in 4 days"
    objectHeader.statusText = "Available"
    objectHeader.detailImage = #imageLiteral(resourceName: "attachment009.5")

// List section definition
class LocationSection: FUIObjectListSection {
    lazy var cellProvider: ((AnyTableBasedFloorplan, IndexPath, AnyHashable) -> UITableViewCell)? = { floorplan, indexPath, element in
        let cell = floorplan.base.tableView.dequeueReusableCell(withIdentifier: FUIObjectTableViewCell.reuseIdentifier, for: indexPath) as! FUIObjectTableViewCell
        // set properties for object cell
        return cell

    var cellTypeAndReuseIdentifier: (AnyClass, String) {
        return (FUIObjectTableViewCell.self, FUIObjectTableViewCell.reuseIdentifier)

// Collection section definition
class ProductComponentsSection: FUIObjectCollectionSection {

    var elements: [AnyHashable]

    lazy var cellProvider: ((AnyTableBasedFloorplan, UICollectionView, IndexPath, AnyHashable) -> UICollectionViewCell)? = { _, collectionView, indexPath, element in
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MyThumbnailCollectionViewCell.reuseIdentifier, for: indexPath) as! MyThumbnailCollectionViewCell
        // set properties for MyThumbnailCollectionViewCell
        return cell

    lazy var headerProvider: ((AnyTableBasedFloorplan, Int) -> UITableViewHeaderFooterView)? = { [unowned self] floorplan, _ in
        let header = floorplan.base.tableView.dequeueReusableHeaderFooterView(withIdentifier: FUITableViewHeaderFooterView.reuseIdentifier) as! FUITableViewHeaderFooterView = .title
        header.titleLabel.text = "Subcomponents"
        return header

    var cellTypeAndReuseIdentifier: (AnyClass, String) {
        return (MyThumbnailCollectionViewCell.self, MyThumbnailCollectionViewCell.reuseIdentifier)

    init(components: [String]) {
        self.elements = components

let objectFloorplan = FUIObjectFloorplan(object: Product(), style: .grouped, objectHeaderProvider: objectHeaderBinding)

objectFloorplan.sectionsProvider = { _ in
    return [
        ProductComponentsSection(components: components)

Tap Action Handling

Implement elementDidTapHandler to handle the tap action on section elements. For header and footer use sectionHeaderDidTapHandler and sectionFooterDidTapHandler.


Supported ObjectHeader class paths:


Supported ObjectHeader attributes:

Refer to FUIObjectHeader documentation for more information.

Last update: December 8, 2020