ReusableViewConfig
public struct ReusableViewConfig<Item, Cell> : ReusableViewConfigProtocol where Cell : ReusableViewProtocol
A ReusableViewConfig is a concrete ReusableViewConfigProtocol type.
This config is responsible for producing and configuring reusable views for a specific item.
Cells can be for either collection views or table views.
-
Configures the cell for the specified item, parent view, and index path.
Declaration
Swift
public typealias ViewConfigurator = (Cell, Item?, ReusableViewType, Cell.ParentView, IndexPath) -> CellParameters
cellThe cell to be configured at the index path.
itemThe item at
indexPath.typeThe type of reusable view.
parentViewThe collection view or table view requesting this information.
indexPathThe index path at which the cell will be displayed.
Return Value
The configured cell.
-
A unique identifier that describes the purpose of the cells that the config produces. The config dequeues cells from the collection view or table view with this reuse identifier.
Note
Clients are responsible for registering a cell for this identifier with the collection view or table view.Declaration
Swift
public let reuseIdentifier: String -
The type of the reusable view.
Declaration
Swift
public let type: ReusableViewType -
A closure used to configure the views.
Declaration
Swift
public let viewConfigurator: ViewConfigurator
-
Constructs a new reusable view config.
Declaration
Swift
public init(reuseIdentifier: String, type: ReusableViewType = .cell, viewConfigurator: @escaping ViewConfigurator)Parameters
reuseIdentifierThe reuse identifier with which to dequeue reusable views.
typeThe type of the reusable view.
viewConfiguratorThe closure with which to configure views.
View on GitHub
ReusableViewConfig Structure Reference