Other Classes

The following classes are available globally.

  • UICollectionView subclass, which invokes a sizeChangeHandler: (() -> Void)? closure, when the current content size of the collection does not match the intrinsic content size. The sizeChangeHandler property is internal to the SDK.

    Developers should generally not initialize FUIResizingCollectionView directly. Instead, instances of the class are typically accessed through the FUITableViewCollectionSection API’s.

    Important

    Resizing behavior will only be executed, if the sizeChangeHandler is implemented.

    Declaration

    Swift

    @available(*, deprecated, message: "If using as subview of UITableViewCell: use FUICollectionViewTableViewCell instead; if using generally: use UICollectionView instead.")
    public class FUIResizingCollectionView : UICollectionView
  • A UITableViewHeaderFooterView subclass, which supports top and bottom padding and separators.

    See more

    Declaration

    Swift

    open class FUIBaseTableViewHeaderFooterView : UITableViewHeaderFooterView, FUIViewBorderDrawing
  • The FUITableViewCollectionSection control is designed to be used, when a section in a UITableView should be dedicated to displaying a UICollectionView, and, the height of that section should adjust to fit its contents.

    FUITableViewCollectionSection

    The collection section produces a single FUICollectionViewTableViewCell, which refreshes its height, after its subview FUICollectionView calculates the sizes of its subview UICollectionViewCell items.

    A developer uses the FUITableViewCollectionSection, by assigning a data source (/and delegate) to its collectionView: FUICollectionView property; then, he or she should supply its collectionViewTableViewCell property to a UITableViewDataSource.tableView(_:cellForRowAt:) implementation.

    Important

    A developer should retain a strong reference to a FUITableViewCollectionSection.

    ## Usage

        let workorders: [WorkOrder] = [WorkOrder]()
    
        override public func viewDidLoad() {
    
            let workOrdersLayout = FUICollectionViewLayout.horizontalFlow
            workOrdersLayout.itemSize = CGSize(width: 200, height: 200)
            self.workOrdersSection = FUITableViewCollectionSection(tableView: self.tableView, collectionViewLayout: workOrdersLayout)
            self.workOrdersSection.collectionView.dataSource = self
            self.workOrdersSection.collectionView.register(FUISimpleCollectionViewCell.self, forCellWithReuseIdentifier: FUISimpleCollectionViewCell.reuseIdentifier)
            self.workOrdersSection.collectionView.delegate = self
            self.workOrdersSection.collectionView.isScrollEnabled = false
    
            self.tableView.estimatedRowHeight = 98
            #if swift(>=4.2)
                self.tableView.rowHeight = UITableView.automaticDimension
            #else
                self.tableView.rowHeight = UITableViewAutomaticDimension
            #endif
    
        }
    
        // MARK:  UITableViewDataSource
        override public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
            return 1
        }
    
        public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            return self.workOrdersSection.collectionViewTableViewCell
        }
    
        // MARK:  UICollectionViewDataSource
        public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    
            switch collectionView {
            case workOrdersSection.collectionView:
                let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUISimpleCollectionViewCell.reuseIdentifier,
                                                                              for: indexPath) as! FUISimpleCollectionViewCell
                cell.contentImageView.image = UIImage(named: "WorkOrderImage")
                cell.titleLabel.text = "Work Order: \(indexPath.item)"
                return cell
            default:
                // ...
            }
        }
    
    See more

    Declaration

    Swift

    open class FUITableViewCollectionSection
  • This class is an implementation of FUIAttachmentAction to allow user to choose a file using UIDocumentPickerViewController as an attachment in FUIAttachmentsFormView.

    If the application wants to have its Document directory accessible by the UIDocumentPickerViewController, the application needs to have the following 2 properties set to true in its plist:

    • “Supports opening documents in place” (LSSupportsOpeningDocumentsInPlace)
    • “Application supports iTunes file sharing” (UIFileSharingEnabled)

    Note that the file URL returned by the document picker is a temporary url. The content of the file may not be available after the document picker is closed. Therefore, developer should copy the file content to a location that it may attach the file content later.

    
    class TestFormTableViewController: FUIFormTableViewController {
        override func viewDidLoad() {
            // ...
    
            // prepare temporary directory to hold attachment files
        }
    
        // ...
    
        override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            // ...
    
            let cell = tableView.dequeueReusableCell(withIdentifier: FUIAttachmentsFormCell.reuseIdentifier, for: indexPath) as! FUIAttachmentsFormCell
            cell.attachmentsController.delegate = self
            cell.attachmentsController.dataSource = self
            cell.attachmentsController.reloadData()
    
            let documentPickerAction = FUIDocumentPickerAttachmentAction()
            documentPickerAction.delegate = self
            cell.attachmentsController.addAttachmentAction(documentPickerAction)
    
            return cell
        }
    }
    
    extension TestFormTableViewController: FUIDocumentPickerAttachmentActionDelegate {
        var documentPicker: UIDocumentPickerViewController {
          return UIDocumentPick  erViewController(documentTypes: ["public.data"], in: .import)
        }
    
        func documentPickerAttachmentAction(_ action: FUIDocumentPickerAttachmentAction, didPickFileAt url: URL) {
            if let savedUrl = saveFileToTempFolder(url) {
                self.addAttachmentURL(savedUrl)
            }
            self.tableView.reloadSections(IndexSet(integer:self.attachmentSection), with: .automatic)
       }
    }
    

    Attention

    The delegate object with type FUIDocumentPickerAttachmentActionDelegate is declared as a weak reference. On deallocation it will be automatically set to nil. To keep it alive as expected, developer should retain the delegate object during its whole execution scope.

    See more

    Declaration

    Swift

    public class FUIDocumentPickerAttachmentAction : NSObject, FUIAttachmentAction
  • Base view for map snapshot form cell. Typically not used directly by developer.

    See more

    Declaration

    Swift

    public class FUIFormEntryView<FormValueView> : FUIBaseDrawingView, FUITitleComponent, FUIStatusComponent, FUIAttributesProvider where FormValueView : UIView
  • Map snapshot form cell, where the custom geometry is shown on a map-based imagery.

    Developer may specify the geometry object to display, and configure the title text, status text, and accessory type.

    This cell height is automatically adjusted to allow the whole content to be displayed.

    Usage

    let snapshotFormCell = tableView.dequeueReusableCell(withIdentifier: FUIMapSnapshotFormCell.reuseIdentifier,
                                                         for: indexPath) as! FUIMapSnapshotFormCell
    snapshotFormCell.title.text = "Location"
    snapshotFormCell.geometry = self.provider?.editingGeometry
    if let coordinates = snapshotFormCell.coordinates {
       let numOfPoints = coordinates.count
       snapshotFormCell.status.text = numOfPoints > 1 ? "\(numOfPoints) Points Added" : "\(numOfPoints) Point Added"
    }
    snapshotFormCell.accessoryType = .disclosureIndicator
    return snapshotFormCell
    
    See more

    Declaration

    Swift

    public class FUIMapSnapshotFormCell : FUIBaseDrawingTableViewCell<FUIMapSnapshotContentView>
  • This is an implementation of FUIFormattedStringEditing on top of the regular iOS NumberFormatter.

    The main enhancement is to add the support to handle cursor positions.

    Here are two examples when using with the FUITextFieldFormCell:

    • As a currency number formatter

      let cell = tableView.dequeueReusableCell(withIdentifier: FUITextFieldFormCell.reuseIdentifier) as! FUITextFieldFormCell
      cell.keyName = "Price"
      cell.keyboardType = .decimalPad
      let formatter = FUINumberFormatter()
      formatter.numberStyle = .currency
      cell.formatter = formatter
      ...
      

      The text field will display $12.34 when user types 12.34.

    • With custom suffix

      let cell = tableView.dequeueReusableCell(withIdentifier: FUITextFieldFormCell.reuseIdentifier) as! FUITextFieldFormCell
      cell.keyName = "Weight"
      cell.keyboardType = .decimalPad
      let formatter = FUINumberFormatter()
      formatter.numberStyle = .decimal
      formatter.maximumFractionDigits = 3
      formatter.positiveSuffix = "lbs"
      cell.formatter = formatter
      

      The text field will display 1.234lbs when user types 1.234.

    Declaration

    Swift

    open class FUINumberFormatter : NumberFormatter, FUIFormattedStringEditing
  • A FUIFormattedStringEditing implementation to format phone number.

    This formatter accepts only digit characters 0 through 9. All other characters user typed are ignored.

    The default format is (###) ###-####. Which correspond to US phone number system. Developer could change the format to fit phone number for other countries.

    See more

    Declaration

    Swift

    open class FUIPhoneNumberFormatter : FUIFormattedStringEditing
  • FUIGridTableViewHeaderFooterView is a FIori UI component that extends UITableViewHeaderFooterView for showing a list of FUIGridRowItem column titles. It will display as a section header or footer in table view.

    Columns widths may be specified in absolute points, or as a set of fractions in 0.0..<1. A developer may also designate one column for flexible width, by assigning the value -1 to that column width.

    Remark

    Developers should always use the same column widths or percents for all headers, footers and rows in a grid. Developers should also set common accessory types to rows, headers and footers.

    The FUIGridTableViewHeaderFooterView is adaptive for regular and compact horizontal content modes. It is hidden by design, when in compact mode. The AutoLayout automatic dimension technique should be used for computing the height.

    Example Initialization and Configuration:

    override open func viewDidLoad() {
    super.viewDidLoad()
    tableView.sectionHeaderHeight = UITableViewAutomaticDimension
    tableView.estimatedSectionHeaderHeight = 100
    tableView.register(FUIGridTableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: FUIGridTableViewHeaderFooterView.reuseIdentifier)
    }
    

    Override tableView(_: viewForHeaderInSection:) dataSource method and configure header.

    // header data list
    var headerData: [FUIGridRowItem] {
    let item0 = FUIGridRowHeaderItem(text: " ")
    let item1 = FUIGridRowHeaderItem(text: "Symbol")
    let item2 = FUIGridRowHeaderItem(text: "Open")
    let item3 = FUIGridRowHeaderItem(text: "High")
    let item4 = FUIGridRowHeaderItem(text: "Low")
    let item5 = FUIGridRowHeaderItem(text: "Close")
    return [item0, item1, item2, item3, item4, item5]
    }
    
    // set column widths.  Should be shared by rows and header.
    let columnWidths = [-1, 0.2, 0.1, 0.1, 0.1, 0.1]
    
    // configure header view
    header.gridItems = headerData
    header.columnWidthPercent = columnWidths
    header.accessoryType = .disclosureIndicator // match row cell accessory types!
    
    
    See more

    Declaration

    Swift

    open class FUIGridTableViewHeaderFooterView : FUIBaseTableViewHeaderFooterView
  • FUIGridTableViewSummaryFooter is a Fiori UI component that extends UITableViewHeaderFooterView for showing a list of FUIGridRowItem column titles. It displays as a section footer in table view.

    Columns widths may be specified in absolute points, or as a set of fractions in 0.0..<1. A developer may also designate one column for flexible width, by assigning the value -1 to that column width.

    Remark

    Developers should always use the same column widths or percents for all headers, footers and rows in a grid. Developers should also set common accessory types to rows, headers and footers.

    The FUIGridTableViewSummaryFooter is adaptive for regular and compact horizontal content modes. It is hidden by design, when in compact mode. The AutoLayout automatic dimension technique should be used for computing the footer height.

    Example Initialization and Configuration:

    override open func viewDidLoad() {
    super.viewDidLoad()
    tableView.sectionFooterHeight = UITableViewAutomaticDimension
    tableView.estimatedSectionFooterHeight = 100
    tableView.register(FUIGridTableViewSummaryFooter.self, forHeaderFooterViewReuseIdentifier: FUIGridTableViewSummaryFooter.reuseIdentifier)
    }
    

    Override tableView(_: viewForFooterInSection:) dataSource method and configure header.

    // header data list
    var footerData: [FUIGridRowItem] {
    let item0 = FUIGridRowSummaryItem(text: "Total")
    let item1 = FUIGridRowSummaryItem(text: "10")
    let item2 = FUIGridRowSummaryItem(text: "10")
    let item3 = FUIGridRowSummaryItem(text: "10")
    let item4 = FUIGridRowSummaryItem(text: "10")
    let item5 = FUIGridRowSummaryItem(text: "10")
    return [item0, item1, item2, item3, item4, item5]
    }
    
    // set column widths.  Should be shared by rows and header.
    let columnWidths = [-1, 0.2, 0.1, 0.1, 0.1, 0.1]
    
    // configure header view
    footer.gridItems = headerData
    footer.columnWidthPercent = columnWidths
    footer.accessoryType = .disclosureIndicator // match row cell accessory types!
    
    

    Declaration

    Swift

    open class FUIGridTableViewSummaryFooter : FUIGridTableViewHeaderFooterView
  • A view controller showing popover list for creating geometry in map view.

    Usage

    Initialize the popover content view controller.

    var popoverContent = FUICreateGeometryPopOverTableViewController()
    

    Define selection behavior and do some setup for map legend items.

    @objc private func presentCreatePopover() {
       popoverContent.items = createGeometryItems
       popoverContent.modalPresentationStyle = .popover
       let popover = popoverContent.popoverPresentationController
       let createGeometryResultsController = CreateGeometryResultsController()
       popoverContent.didSelectHandler = { [unowned self] createItem in
           createGeometryResultsController.editingGeometryMapLegendItem = createItem
           self.navigationController?.pushViewController(createGeometryResultsController, animated: true)
       }
       popover?.barButtonItem = plusBarButtonItem
       self.present(popoverContent, animated: true, completion: nil)
    }
    
    See more

    Declaration

    Swift

    open class FUICreateGeometryPopOverTableViewController : FUIResizablePopoverContainer, UITableViewDelegate, UITableViewDataSource
  • FUIEditingGeometryObject a generic object that specifies the accepted FUIGeometryType, Representation Type, and Map Type.

    Variables Available in FUIEditingGeometryObject:

    • geometry: The geometry associated with the editing object

    • cachedGeometry: The cached instance of the geometry

    • cachedIndex: The cached index for polylines and polygons for their selected index

    Methods Available in FUIEditingGeometryObject:

    • addRepresentation(to context: MapContextType): A method to add the geometry to the map.

    • removeRepresentation(from context: MapContextType): A method to remove the geometry from the map.

    • redrawRepresentation(in context: MapContextType, with existingCoordinates: [CLLocationCoordinate2D], for colorScheme: FUIBackgroundColorScheme): A method to re-draw the geometry display in the map.

    See more

    Declaration

    Swift

    public class FUIEditingGeometryObject<GeometryType, RepresentationType, MapContextType> : FUIManageRepresentation where GeometryType : FUIGeometry
  • A generic class supports both MapKit and Esri for storing route segments and stops information.

    See more

    Declaration

    Swift

    open class FUIRoute<LineGeometry, PointGeometry> where LineGeometry : FUIPolyline, PointGeometry : FUIPoint
  • A subclass of FUIMapFloorplanViewController designed to be used with ArcGIS framework. You can use it to display business objects(points, polylines, polygons) on the map view and view details by selecting a business object. It also supports clustering of point geometries.

    Usage

    The map view consists of mutiple FUIGeometryLayers. By assigning geometries onto different layers, you can show/hide all geometries on a specified layer using setLayerHidden(_:hidden:) api.

    1. Implement FUIEsriMapViewDataSource methods.

    In the floorplan controller viewDidLoad() set the datasource.

    self.dataSource = dataSource
    
    func numberOfLayers(in mapView: AGSMapView) -> Int {
       return 1
    }
    
    func mapView(_ mapView: AGSMapView, layerAtIndex index: Int) -> FUIGeometryLayer {
       return FUIGeometryLayer("Functional Location")
    }
    
    func mapView(_ mapView: AGSMapView, geometriesForLayer layer: FUIGeometryLayer) -> [AGSGeometry] {
       return geometries
    }
    

    You can also use native ArcGIS api to add graphics to map view. But the FUIEsriMapViewDelegate object is not able to manage these graphics.

    1. Implement FUIEsriMapViewDelegate methods as needed.

    Determine the visual presentation of the geometry. (color, size, etc)

    func mapView(_ mapView: AGSMapView, willRender graphic: AGSGraphic, forGeometryAtIndex index: Int, in layer: FUIGeometryLayer, in state: FUIMapFloorplan.State) {
       graphic.symbol = customizedSymbol
    }
    
    func mapView(_ mapView: AGSMapView, willRender clusterGraphic: AGSGraphic, for geometryIndexesInLayers: [FUIGeometryLayer : [Int]], in state: FUIMapFloorplan.State) {
       clusterGraphic.symbol = customizedSymbol
    }
    

    Respond to select/deselect action

    func mapView(_ mapView: AGSMapView, didSelect geometry: AGSGeometry, at index: Int, in layer: FUIGeometryLayer) {}
    
    func mapView(_ mapView: AGSMapView, didSelect geometries: [AGSGeometry], at geometryIndexesInLayers: [FUIGeometryLayer: [Int]]) {}
    
    func mapView(_ mapView: AGSMapView, didDeselect geometry: AGSGeometry, at index: Int, in layer: FUIGeometryLayer) {}
    
    func mapView(_ mapView: AGSMapView, didDeselect geometries: [AGSGeometry], at geometryIndexesInLayers: [FUIGeometryLayer: [Int]]) {}
    

    Theming

    See more
  • A subclass of FUIMKMapFloorplanViewController designed to be used with MapKit framework. It adds additional functionality to map floorplan controller to support routes display.

    Usage

    Create a FUIRoute instance for each route you want to display. Make sure your route stop geometry type extends MKPointAnnotation and FUIAnnotation, and route segment geometry type extends MKPolyline and FUIOverlay.

    1. Implement FUIMKRoutingMapViewDataSource methods.

    In the routing floorplan controller viewDidLoad() set the datasource.

    self.dataSource = dataSource
    
    func numberOfRoutes(in mapView: MKMapView) -> Int { return 1 }
    
    func mapView(_ mapView: MKMapView, routeAt index: Int) -> FUIRoute<MKPolyline, MKPointAnnotation> { return fuiRoute }
    
    1. FUIMKRoutingMapViewDelegate provides more functionalities that you can make your app more powerful.

    In the floorplan controller viewDidLoad() set the delegate.

    self.delegate = delegate
    

    Determine how annotation view/overlay renderer should appear. You can customize the view/render provided with fiori default styles.

    func mapView(_ mapView: MKMapView, willRender annotationView: MKAnnotationView, forVertexAtIndex vertexIndex: Int, inRouteAt routeIndex: Int, in state: FUIMapFloorplan.State) {
       switch annotationView {
       case is FUICircleAnnotationView:
           (annotationView as! FUICircleAnnotationView).innerColor = .red
       case is FUIMarkerAnnotationView:
           (annotationView as! FUIMarkerAnnotationView).markerTintColor = .blue
       default:
           break
       }
    }
    

    Respond to route select/deselect action

    func mapView(_ mapView: MKMapView, didSelectRouteAt index: Int)
    
    func mapView(_ mapView: MKMapView, didSelectVertexAt vertexIndex: Int, inRouteAt routeIndex: Int)
    
    func mapView(_ mapView: MKMapView, didDeselectRouteAt index: Int)
    
    func mapView(_ mapView: MKMapView, didDeselectVertexAt vertexIndex: Int, inRouteAt routeIndex: Int)
    

    Theming

    See more

    Declaration

    Swift

    open class FUIMKRoutingFloorplanViewController : FUIMKMapFloorplanViewController
  • Style definition for the chart. Gives access to the chart theming.

    See more

    Declaration

    Swift

    public class FUIChartStyle