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
  • 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. So 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
  • This is the new implementation to replace the FUIKeyValueFormCell. It has a keyName field and an editable value text field to let user entered the value for this property. This cell height is automatically adjusted to allow the whole content to be displayed. However, the cell height is also limited to the height of the screen above the soft keyboard height.

    Developer could use to UITableViewDelegate‘s func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat to set a fixed height for the cell.

    Usage

    let cell = tableView.dequeueReusableCell(withIdentifier: FUIDrawingKeyValueFormCell.reuseIdentifier) as! FUIDrawingKeyValueFormCell
    cell.onChangeHandler = { [unowned self] newValue in
        print("value: \(newValue)")
        self.value = newValue
    }
    cell.keyName = "Project Title"
    cell.placeholder.text = "Please enter a title"
    cell.value = value
    cell.isTrackingLiveChanges = true
    return cell
    

    Theming

    Supported TEXT class paths:

    fdlFUIDrawingKeyValueFormCell_title {}
    fdlFUIDrawingKeyValueFormCell_valueText {}
    fdlFUIDrawingKeyValueFormCell_placeholder {}
    

    Supported TEXT properties:

    font-color: Color;
    font-style: UIFontTextStyle;
    
    See more

    Declaration

    Swift

    open class FUIDrawingKeyValueFormCell : FUIDrawingNoteFormCell, FUIPropertyFormCell
  • The base class for auto-fitting form table view cell, such as FUIDrawingNoteFormCell.

    See more

    Declaration

    Swift

    open class FUIAutofittingDrawingTableViewCell<InnerView> : FUIBaseDrawingTableViewCell<InnerView>, InnerViewContainerEventHandling, FUIInlineValidation where InnerView : UIView, InnerView : FUIBackgroundSchemeSupporting, InnerView : FUICalculateLayout, InnerView : FUIStyleByStringAttributes
  • This is the new implementation to replace the FUINoteFormCell, to allow user enter notes. This cell height is automatically adjusted to allow the whole content to be displayed. However, the cell height is also limited to the height of the screen above the soft keyboard height.

    Developer could use to UITableViewDelegate‘s func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat to set a fixed height for the cell.

    ## Usage

     let cell = tableView.dequeueReusableCell(withIdentifier: FUIDrawingNoteFormCell.reuseIdentifier) as! FUIDrawingNoteFormCell
     cell.onChangeHandler = { [unowned self] newValue in
         self.noteText = newValue
     }
     cell.placeholder.text = "Enter Description"
     cell.value = noteText
     cell.isTrackingLiveChanges = true
    

    ## Theming

    Supported TEXT class paths:

        fdlFUIDrawingNoteFormCell_valueText {}
        fdlFUIDrawingNoteFormCell_placeholder {}
    

    Supported TEXT properties:

        font-color: Color;
        font-style: UIFontTextStyle;
    
    See more

    Declaration

    Swift

    open class FUIDrawingNoteFormCell : FUIAutofittingDrawingTableViewCell<FUINoteFormCellContentView>, FUIFormCell
  • 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>
  • 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.

    See more

    Declaration

    Swift

    public class FUIEditingGeometryObject<GeometryType, RepresentationType, MapContextType> : FUIManageRepresentation where GeometryType : FUIGeometry