FUIFormTableViewController
@MainActor
open class FUIFormTableViewController : UITableViewController, FUIFormCellResponderDelegate, FUIFormCellNavigationDelegate
When FUIFormCells are to be used in an application, application’s implementation of
UITableViewController that hosts these FUIFormCells must be a subclass of this
FUIFormTableViewController. FUIFormTableViewController hides all the complications
and interactions for handling all different types of FUIFormCells.
Application’s implementation of the UITableViewController needs to only
implement the following functions:
class FormCellTestTVC: FUIFormTableViewController {
override func viewDidLoad() {
// MUST: Call viewDidLoad function of super class.
super.viewDidLoad()
// Register FUIFormCells that will be used
self.tableView.register(FUITitleFormCell.self, forCellReuseIdentifier: FUITitleFormCell.reuseIdentifier)
...
}
override func numberOfSections(in tableView: UITableView) -> Int {
// Return how many section in the table
return ...
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Return number of rows in each section
...
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Return the cell to be used at the IndexPath specified
let cell = tableView.dequeueReusableCell(withIdentifier: FUITitleFormCell.reuseIdentifier, for: indexPath) as! FUITitleFormCell
cell.value = "Work Request"
cell.isEditable = true
// MARK: implement onChangeHandler
cell.onChangeHandler = { newValue in
myObject.title = newValue
}
return cell
}
In addition, if there are some other actions on the table view, it is required that
the action functions should also call function endEditing of the table view with the
force parameter to true so that all
editing cells have its onChangeHandler called. For example, the function didSaveTapped
below is the action when the “Save” button tapped:
@IBAction func didSaveTapped(_ sender: AnyObject) {
self.tableView.endEditing(true)
// save object ...
}
-
The effective
UINavigationController.Developer could set this to the
UINavigationControllerfor this view controller. If developer did not set this value, theUINavigationControllerof this view controller will be returned if it is not nil. Otherwise, the rootUINavigationControllerfrom thekeyWindow, if any, will be returned.Declaration
Swift
@MainActor public var effectiveNavigationController: UINavigationController? { get set } -
Workaround for the compile issue where empty initializer is not accessible in xcframework.
Declaration
Swift
@MainActor required public init() -
This function allows developers to close the picker using code.
Declaration
Swift
@MainActor public func resetIndexPathSelection()
-
Enhanced dequeue method that provides automatic FormCell registration and picker state management. Use this method instead of tableView.dequeueReusableCell in your cellForRowAt implementation.
Declaration
Swift
@MainActor public func dequeueReusableCells(withIdentifier identifier: String, for indexPath: IndexPath) -> UITableViewCellParameters
identifierThe reuse identifier for the cell
indexPathThe index path for the cell
Return Value
A configured UITableViewCell with automatic FormCell registration