ReusableViewConfigProtocol
public protocol ReusableViewConfigProtocol
An instance conforming to ReusableViewConfigProtocol is responsible for initializing
and configuring reusable views to be displayed in either a UICollectionView or a UITableView.
-
The type of elements backing the collection view or table view.
Declaration
Swift
associatedtype Item -
The type of views that the configuration produces.
Declaration
Swift
associatedtype View : ReusableViewProtocol
-
Provides a view reuse identifer for the given item, type, and indexPath.
Declaration
Swift
func reuseIdentiferFor(item: Item?, type: ReusableViewType, indexPath: IndexPath) -> StringParameters
itemThe item at
indexPath.typeThe type of reusable view.
indexPathThe index path that specifies the location of the view.
Return Value
An identifier for a reusable view.
-
Configures and returns the specified view.
Declaration
Swift
@discardableResult func configure(view: View, item: Item?, type: ReusableViewType, parentView: View.ParentView, indexPath: IndexPath) -> ViewParameters
viewThe view to configure.
itemThe item at
indexPath.typeThe type of reusable view.
parentViewThe collection view or table view requesting this information.
indexPathThe index path that specifies the location of
viewanditem.Return Value
A configured view of type
View.
-
tableCellFor(item:tableView:indexPath:)Extension methodCreates a new
Viewinstance, or dequeues an existing cell for reuse, then configures and returns it.Declaration
Parameters
itemThe item at
indexPath.tableViewThe table view requesting this information.
indexPathThe index path that specifies the location of the cell and item.
Return Value
An initialized or dequeued, and fully configured table cell.
-
collectionCellFor(item:collectionView:indexPath:)Extension methodCreates a new
Viewinstance, or dequeues an existing cell for reuse, then configures and returns it.Declaration
Parameters
itemThe item at
indexPath.collectionViewThe collection view requesting this information.
indexPathThe index path that specifies the location of the cell and item.
Return Value
An initialized or dequeued, and fully configured collection cell.
-
supplementaryViewFor(item:kind:collectionView:indexPath:)Extension methodCreates a new
Viewinstance, or dequeues an existing view for reuse, then configures and returns it.Declaration
Parameters
itemThe item at
indexPath.kindThe kind of supplementary view to retrieve.
collectionViewThe collection view requesting this information.
indexPathThe index path that specifies the location of the view and item.
Return Value
An initialized or dequeued, and fully configured supplementary view.
View on GitHub
ReusableViewConfigProtocol Protocol Reference