FUIFormCollectionViewController
@MainActor
open class FUIFormCollectionViewController : UICollectionViewController
When FUIListPickerCollectionViewCells are to be used in an application, the application’s implementation of
UICollectionViewController that hosts these FUIListPickerCollectionViewCells must be a subclass of this
FUIFormCollectionViewController. FUIFormCollectionViewController hides all the complexity
and interactions for handling FUIListPickerCollectionViewCell.
The application’s implementation of the UICollectionViewController needs to only
implement the following functions:
class FormCollectionViewCellTestTVC: UICollectionViewController {
override func viewDidLoad() {
// MUST: Call viewDidLoad function of super class.
super.viewDidLoad()
// Register FUIFormCells that will be used
self.collectionView.register(FUIListPickerCollectionViewCell.self, forCellWithReuseIdentifier: FUIListPickerCollectionViewCell.reuseIdentifier)
...
}
override func numberOfSections(in collectionView: UICollectionView) -> Int {
// Return how many sections are in the collection
return ...
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// Return number of items in each section
return ...
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
// Return the cell to be used at the IndexPath specified
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FUIListPickerCollectionViewCell.reuseIdentifier, for: indexPath) as! FUIListPickerCollectionViewCell
cell.keyName = "Pick One"
cell.isEnabled = true
// MARK: implement onChangeHandler
cell.onChangeHandler = { newValue in
myObject.title = newValue
}
return cell
}
-
The effective
UINavigationController.The developer could set this to the
UINavigationControllerfor this view controller. If the developer did not set this value, theUINavigationControllerof this view controller will be returned if it is notnil. Otherwise, the rootUINavigationControllerfrom thekeyWindow, if any, will be returned.Declaration
Swift
@MainActor public var effectiveNavigationController: UINavigationController? { get set } -
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 collectionView.dequeueReusableCell in your cellForRowAt implementation.
Declaration
Swift
@MainActor public func dequeueReusableCells(withReuseIdentifier identifier: String, for indexPath: IndexPath) -> UICollectionViewCellParameters
identifierThe reuse identifier for the cell
indexPathThe index path for the cell
Return Value
A configured UICollectionViewCell with automatic FormCell registration